Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Update Boilerplate
Browse files Browse the repository at this point in the history
Signed-off-by: Flyte-Bot <[email protected]>
  • Loading branch information
flyte-bot committed Dec 3, 2021
1 parent 30f45d3 commit 2686f75
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion boilerplate/flyte/golang_support_tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/flyteorg/boilerplate

go 1.17
go 1.16

require (
github.com/alvaroloes/enumer v1.1.2
Expand Down
3 changes: 1 addition & 2 deletions boilerplate/flyte/golang_support_tools/tools.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//go:build tools
// +build tools

package tools
Expand All @@ -7,6 +6,6 @@ import (
_ "github.com/alvaroloes/enumer"
_ "github.com/flyteorg/flytestdlib/cli/pflags"
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
_ "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc"
_ "github.com/vektra/mockery/cmd/mockery"
- "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc"
)
4 changes: 4 additions & 0 deletions boilerplate/flyte/golang_test_targets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
download_tooling: #download dependencies (including test deps) for the package
@boilerplate/flyte/golang_test_targets/download_tooling.sh

.PHONY: generate
generate: download_tooling #generate go code
@boilerplate/flyte/golang_test_targets/go-gen.sh

.PHONY: lint
lint: download_tooling #lints the package for common code smells
GL_DEBUG=linters_output,env golangci-lint run --deadline=5m --exclude deprecated -v
Expand Down
22 changes: 22 additions & 0 deletions boilerplate/flyte/golang_test_targets/go-gen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -ex

echo "Running go generate"
go generate ./...

# This section is used by GitHub workflow to ensure that the generation step was run
if [ -n "$DELTA_CHECK" ]; then
DIRTY=$(git status --porcelain)
if [ -n "$DIRTY" ]; then
echo "FAILED: Go code updated without commiting generated code."
echo "Ensure make generate has run and all changes are committed."
DIFF=$(git diff)
echo "diff detected: $DIFF"
DIFF=$(git diff --name-only)
echo "files different: $DIFF"
exit 1
else
echo "SUCCESS: Generated code is up to date."
fi
fi

0 comments on commit 2686f75

Please sign in to comment.