mirror of
https://github.com/peco/peco.git
synced 2026-09-10 07:16:29 -04:00
Check for generated files
This commit is contained in:
parent
6bce9be413
commit
c3c4116dc0
31
.github/workflows/ci.yml
vendored
31
.github/workflows/ci.yml
vendored
|
|
@ -29,3 +29,34 @@ jobs:
|
|||
run: make test
|
||||
- name: Build all targets
|
||||
run: make all
|
||||
|
||||
generate:
|
||||
runs-on: ubuntu-latest
|
||||
name: Check generated code
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
|
||||
with:
|
||||
go-version: stable
|
||||
check-latest: true
|
||||
- name: Install stringer
|
||||
run: go install golang.org/x/tools/cmd/stringer@latest
|
||||
- name: Run go generate
|
||||
run: go generate ./...
|
||||
- name: Check for uncommitted changes
|
||||
run: |
|
||||
if ! git diff --exit-code; then
|
||||
echo "::error::Generated code is out of date. Run 'go generate ./...' and commit the result."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//go:generate stringer -type PagingRequestType
|
||||
//go:generate stringer -type PagingRequestType -output paging_request_type_gen.go
|
||||
|
||||
package hub
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Code generated by "stringer -type PagingRequestType"; DO NOT EDIT.
|
||||
// Code generated by "stringer -type PagingRequestType -output paging_request_type_gen.go"; DO NOT EDIT.
|
||||
|
||||
package hub
|
||||
|
||||
2
peco.go
2
peco.go
|
|
@ -1,4 +1,4 @@
|
|||
//go:generate stringer -type VerticalAnchor -output stringer_vertical_anchor.go .
|
||||
//go:generate stringer -type VerticalAnchor -output vertical_anchor_gen.go .
|
||||
|
||||
package peco
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
// Code generated by "stringer -type VerticalAnchor -output stringer_vertical_anchor.go ."; DO NOT EDIT.
|
||||
|
||||
package peco
|
||||
|
||||
import "fmt"
|
||||
|
||||
const _VerticalAnchor_name = "AnchorTopAnchorBottom"
|
||||
|
||||
var _VerticalAnchor_index = [...]uint8{0, 9, 21}
|
||||
|
||||
func (i VerticalAnchor) String() string {
|
||||
i -= 1
|
||||
if i < 0 || i >= VerticalAnchor(len(_VerticalAnchor_index)-1) {
|
||||
return fmt.Sprintf("VerticalAnchor(%d)", i+1)
|
||||
}
|
||||
return _VerticalAnchor_name[_VerticalAnchor_index[i]:_VerticalAnchor_index[i+1]]
|
||||
}
|
||||
25
vertical_anchor_gen.go
Normal file
25
vertical_anchor_gen.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Code generated by "stringer -type VerticalAnchor -output vertical_anchor_gen.go ."; DO NOT EDIT.
|
||||
|
||||
package peco
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[AnchorTop-1]
|
||||
_ = x[AnchorBottom-2]
|
||||
}
|
||||
|
||||
const _VerticalAnchor_name = "AnchorTopAnchorBottom"
|
||||
|
||||
var _VerticalAnchor_index = [...]uint8{0, 9, 21}
|
||||
|
||||
func (i VerticalAnchor) String() string {
|
||||
idx := int(i) - 1
|
||||
if i < 1 || idx >= len(_VerticalAnchor_index)-1 {
|
||||
return "VerticalAnchor(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _VerticalAnchor_name[_VerticalAnchor_index[idx]:_VerticalAnchor_index[idx+1]]
|
||||
}
|
||||
Loading…
Reference in a new issue