Add CI check to make sure generated code is checked in (#11)
* Minor fixes for tools stuff * Fix the package for the tools.go file * Make it easier to install generate tools by making the install commands generate commands in the tools file * Add CI step to check for generated code Have a CI step that will fail if there's uncommitted generated changes. * Remove erroring generate statement Relevant code no longer requires the use of the stringer package. * Add uncommitted generated code to fix lint error * Fix action lint error * Remove unused type
This commit is contained in:
parent
aa2f0049e1
commit
22f28a996c
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@ -475,6 +475,24 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version-file: src/go.mod
|
go-version-file: src/go.mod
|
||||||
|
|
||||||
|
- name: Run go generate
|
||||||
|
run: |
|
||||||
|
# Install tools used for generate commands in the repo
|
||||||
|
go generate tools.go
|
||||||
|
# Actually run generate commands in the repo.
|
||||||
|
go generate ./...
|
||||||
|
|
||||||
|
- name: Check for uncommitted changes from generated code
|
||||||
|
run: |
|
||||||
|
changes=$(git status --porcelain)
|
||||||
|
if [[ -n "$changes" ]]; then
|
||||||
|
echo "Uncommitted changes detected:"
|
||||||
|
echo "$changes"
|
||||||
|
echo "Run 'go generate' from backend/functions and commit the changes."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "No uncommitted changes detected."
|
||||||
|
|
||||||
- name: Go Lint
|
- name: Go Lint
|
||||||
uses: golangci/golangci-lint-action@v3
|
uses: golangci/golangci-lint-action@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@ -33,21 +33,12 @@ import (
|
|||||||
"github.com/alcionai/canario/src/pkg/services/m365/api/graph"
|
"github.com/alcionai/canario/src/pkg/services/m365/api/graph"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DataCategory int
|
|
||||||
|
|
||||||
// channel sizes
|
// channel sizes
|
||||||
const (
|
const (
|
||||||
collectionChannelBufferSize = 50
|
collectionChannelBufferSize = 50
|
||||||
fetchChannelSize = 5
|
fetchChannelSize = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate stringer -type=DataCategory
|
|
||||||
const (
|
|
||||||
Unknown DataCategory = 0
|
|
||||||
List DataCategory = 1
|
|
||||||
Pages DataCategory = 2
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ data.BackupCollection = &prefetchCollection{}
|
_ data.BackupCollection = &prefetchCollection{}
|
||||||
_ data.BackupCollection = &lazyFetchCollection{}
|
_ data.BackupCollection = &lazyFetchCollection{}
|
||||||
|
|||||||
@ -11,11 +11,12 @@ func _() {
|
|||||||
_ = x[OpUnknown-0]
|
_ = x[OpUnknown-0]
|
||||||
_ = x[Backup-1]
|
_ = x[Backup-1]
|
||||||
_ = x[Restore-2]
|
_ = x[Restore-2]
|
||||||
|
_ = x[Export-3]
|
||||||
}
|
}
|
||||||
|
|
||||||
const _Operation_name = "OpUnknownBackupRestore"
|
const _Operation_name = "OpUnknownBackupRestoreExport"
|
||||||
|
|
||||||
var _Operation_index = [...]uint8{0, 9, 15, 22}
|
var _Operation_index = [...]uint8{0, 9, 15, 22, 28}
|
||||||
|
|
||||||
func (i Operation) String() string {
|
func (i Operation) String() string {
|
||||||
if i < 0 || i >= Operation(len(_Operation_index)-1) {
|
if i < 0 || i >= Operation(len(_Operation_index)-1) {
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import (
|
|||||||
|
|
||||||
type comparator string
|
type comparator string
|
||||||
|
|
||||||
//go:generate stringer -type=comparator -linecomment
|
|
||||||
const (
|
const (
|
||||||
UnknownComparator comparator = ""
|
UnknownComparator comparator = ""
|
||||||
// norm(a) == norm(b)
|
// norm(a) == norm(b)
|
||||||
|
|||||||
@ -21,9 +21,9 @@ func _() {
|
|||||||
_ = x[TeamsChatsMetadataService-10]
|
_ = x[TeamsChatsMetadataService-10]
|
||||||
}
|
}
|
||||||
|
|
||||||
const _ServiceType_name = "UnknownServiceexchangeonedrivesharepointexchangeMetadataonedriveMetadatasharepointMetadatagroupsgroupsMetadatachatschatsMetadata"
|
const _ServiceType_name = "UnknownServiceexchangeonedrivesharepointexchangeMetadataonedriveMetadatasharepointMetadatagroupsgroupsMetadatateamsChatsteamsChatsMetadata"
|
||||||
|
|
||||||
var _ServiceType_index = [...]uint8{0, 14, 22, 30, 40, 56, 72, 90, 96, 110, 115, 128}
|
var _ServiceType_index = [...]uint8{0, 14, 22, 30, 40, 56, 72, 90, 96, 110, 120, 138}
|
||||||
|
|
||||||
func (i ServiceType) String() string {
|
func (i ServiceType) String() string {
|
||||||
if i < 0 || i >= ServiceType(len(_ServiceType_index)-1) {
|
if i < 0 || i >= ServiceType(len(_ServiceType_index)-1) {
|
||||||
|
|||||||
@ -13,11 +13,12 @@ func _() {
|
|||||||
_ = x[ServiceOneDrive-2]
|
_ = x[ServiceOneDrive-2]
|
||||||
_ = x[ServiceSharePoint-3]
|
_ = x[ServiceSharePoint-3]
|
||||||
_ = x[ServiceGroups-4]
|
_ = x[ServiceGroups-4]
|
||||||
|
_ = x[ServiceTeamsChats-5]
|
||||||
}
|
}
|
||||||
|
|
||||||
const _service_name = "Unknown ServiceExchangeOneDriveSharePointGroups"
|
const _service_name = "Unknown ServiceExchangeOneDriveSharePointGroupsTeamsChats"
|
||||||
|
|
||||||
var _service_index = [...]uint8{0, 15, 23, 31, 41, 47}
|
var _service_index = [...]uint8{0, 15, 23, 31, 41, 47, 57}
|
||||||
|
|
||||||
func (i service) String() string {
|
func (i service) String() string {
|
||||||
if i < 0 || i >= service(len(_service_index)-1) {
|
if i < 0 || i >= service(len(_service_index)-1) {
|
||||||
|
|||||||
@ -1,7 +1,14 @@
|
|||||||
//go:build tools
|
//go:build tools
|
||||||
// +build tools
|
// +build tools
|
||||||
|
|
||||||
package tools
|
package src
|
||||||
|
|
||||||
|
// When adding a new tool, add the import for it here to make sure it gets a
|
||||||
|
// version in the go.mod file. Also add a go:generate statement here so that we
|
||||||
|
// can install all the tools for CI checks and local development just by running
|
||||||
|
// go generate tools.go.
|
||||||
|
|
||||||
|
//go:generate go install golang.org/x/tools/cmd/stringer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "golang.org/x/tools/cmd/stringer"
|
_ "golang.org/x/tools/cmd/stringer"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user