diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ebe7d58d9..27aa11e88 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -77,7 +77,7 @@ jobs: registry: docker.io username: cueckoo password: ${{ secrets.CUECKOO_DOCKER_PAT }} - - run: go run cuelang.org/go/cmd/cue login --token=${{ secrets.NOTCUECKOO_CUE_TOKEN }} + - run: go tool cue login --token=${{ secrets.NOTCUECKOO_CUE_TOKEN }} - name: Install GoReleaser uses: goreleaser/goreleaser-action@v5 with: @@ -86,7 +86,7 @@ jobs: - name: Run GoReleaser with CUE env: GITHUB_TOKEN: ${{ secrets.CUECKOO_GITHUB_PAT }} - run: go run cuelang.org/go/cmd/cue cmd release + run: go tool cue cmd release working-directory: ./internal/ci/goreleaser - if: startsWith(github.ref, 'refs/tags/v') name: Re-test cuelang.org diff --git a/.github/workflows/trybot.yaml b/.github/workflows/trybot.yaml index 29bea7f48..41a9c9ac8 100644 --- a/.github/workflows/trybot.yaml +++ b/.github/workflows/trybot.yaml @@ -92,7 +92,7 @@ jobs: github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, ' Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) run: go env -w GOFLAGS=-count=1 - - run: go run cuelang.org/go/cmd/cue login --token=${{ secrets.NOTCUECKOO_CUE_TOKEN }} + - run: go tool cue login --token=${{ secrets.NOTCUECKOO_CUE_TOKEN }} - if: (matrix.go-version == '1.25.x' && matrix.runner == 'namespace-profile-linux-amd64-large') name: Early git and code sanity checks run: go run ./internal/ci/checks diff --git a/cue/token/position.go b/cue/token/position.go index 5c1228072..ed4331e46 100644 --- a/cue/token/position.go +++ b/cue/token/position.go @@ -157,7 +157,7 @@ var NoPos = Pos{} // RelPos indicates the relative position of token to the previous token. type RelPos int -//go:generate go run golang.org/x/tools/cmd/stringer -type=RelPos -linecomment +//go:generate go tool stringer -type=RelPos -linecomment const ( // NoRelPos indicates no relative position is specified. diff --git a/cue/token/token.go b/cue/token/token.go index 05579d404..cbe2d774b 100644 --- a/cue/token/token.go +++ b/cue/token/token.go @@ -19,7 +19,7 @@ package token // Token is the set of lexical tokens of the CUE configuration language. type Token int -//go:generate go run golang.org/x/tools/cmd/stringer -type=Token -linecomment +//go:generate go tool stringer -type=Token -linecomment // The list of tokens. const ( diff --git a/encoding/jsonschema/crd.go b/encoding/jsonschema/crd.go index 2e1c288e5..7788a81e8 100644 --- a/encoding/jsonschema/crd.go +++ b/encoding/jsonschema/crd.go @@ -9,7 +9,7 @@ import ( "cuelang.org/go/cue/token" ) -//go:generate go run cuelang.org/go/cmd/cue exp gengotypes . +//go:generate go tool cue exp gengotypes . //go:embed crd.cue var crdCUE []byte diff --git a/encoding/jsonschema/version.go b/encoding/jsonschema/version.go index cff5c0ad8..d9d11beee 100644 --- a/encoding/jsonschema/version.go +++ b/encoding/jsonschema/version.go @@ -19,7 +19,7 @@ import ( "strings" ) -//go:generate go run golang.org/x/tools/cmd/stringer -type=Version -linecomment +//go:generate go tool stringer -type=Version -linecomment type Version int diff --git a/go.mod b/go.mod index 953e879e6..2c560491a 100644 --- a/go.mod +++ b/go.mod @@ -36,3 +36,8 @@ require ( golang.org/x/sys v0.34.0 // indirect gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect ) + +tool ( + cuelang.org/go/cmd/cue + golang.org/x/tools/cmd/stringer +) diff --git a/internal/ci/gen.go b/internal/ci/gen.go index a1426ee8e..18933cfe6 100644 --- a/internal/ci/gen.go +++ b/internal/ci/gen.go @@ -14,4 +14,4 @@ package ci -//go:generate go run cuelang.org/go/cmd/cue cmd gen +//go:generate go tool cue cmd gen diff --git a/internal/ci/repo/repo.cue b/internal/ci/repo/repo.cue index ed5a235ac..47602bb05 100644 --- a/internal/ci/repo/repo.cue +++ b/internal/ci/repo/repo.cue @@ -53,6 +53,3 @@ zeroReleaseTagSuffix: "-0.dev" zeroReleaseTagPattern: "*" + zeroReleaseTagSuffix codeReview: "cue-unity": unityRepositoryURL - -// TODO: we can't use `go tool cue` yet. -cueCommand: "go run cuelang.org/go/cmd/cue" diff --git a/internal/core/adt/composite.go b/internal/core/adt/composite.go index 05d19e210..de9812d94 100644 --- a/internal/core/adt/composite.go +++ b/internal/core/adt/composite.go @@ -365,7 +365,7 @@ func (v *Vertex) MayAttach() bool { return !v.Label.IsLet() && !v.anonymous } -//go:generate go run golang.org/x/tools/cmd/stringer -type=ArcType -trimprefix=Arc +//go:generate go tool stringer -type=ArcType -trimprefix=Arc type ArcType uint8 @@ -465,7 +465,7 @@ type StructInfo struct { // vertexStatus indicates the evaluation progress of a Vertex. type vertexStatus int8 -//go:generate go run golang.org/x/tools/cmd/stringer -type=vertexStatus +//go:generate go tool stringer -type=vertexStatus const ( // unprocessed indicates a Vertex has not been processed before. diff --git a/internal/core/adt/errors.go b/internal/core/adt/errors.go index 89f899d58..7072e9edd 100644 --- a/internal/core/adt/errors.go +++ b/internal/core/adt/errors.go @@ -42,7 +42,7 @@ import ( // control flow. No other aspects of an error may influence control flow. type ErrorCode int8 -//go:generate go run golang.org/x/tools/cmd/stringer -type=ErrorCode -linecomment +//go:generate go tool stringer -type=ErrorCode -linecomment const ( // An EvalError is a fatal evaluation error. diff --git a/internal/core/adt/op.go b/internal/core/adt/op.go index dfa83cbbf..62ba1cf75 100644 --- a/internal/core/adt/op.go +++ b/internal/core/adt/op.go @@ -20,7 +20,7 @@ import "cuelang.org/go/cue/token" // use to evaluate a value. type Op int -//go:generate go run golang.org/x/tools/cmd/stringer -type=Op -linecomment +//go:generate go tool stringer -type=Op -linecomment // Values of Op. const ( diff --git a/internal/core/adt/sched.go b/internal/core/adt/sched.go index 49dd690ca..50f8042a8 100644 --- a/internal/core/adt/sched.go +++ b/internal/core/adt/sched.go @@ -176,7 +176,7 @@ func (s schedState) String() string { // runMode indicates how to proceed after a condition could not be met. type runMode uint8 -//go:generate go run golang.org/x/tools/cmd/stringer -type=runMode +//go:generate go tool stringer -type=runMode const ( // ignore indicates that the new evaluator should not do any processing. diff --git a/internal/core/adt/typocheck.go b/internal/core/adt/typocheck.go index bb8af42d0..d9b881ebd 100644 --- a/internal/core/adt/typocheck.go +++ b/internal/core/adt/typocheck.go @@ -174,7 +174,7 @@ import ( type defID uint32 -//go:generate go run golang.org/x/tools/cmd/stringer -type=defIDType -linecomment +//go:generate go tool stringer -type=defIDType -linecomment type defIDType int8 diff --git a/internal/filetypes/types.go b/internal/filetypes/types.go index f896d60b7..3aaab10e3 100644 --- a/internal/filetypes/types.go +++ b/internal/filetypes/types.go @@ -18,7 +18,7 @@ import ( _ "embed" ) -//go:generate go run golang.org/x/tools/cmd/stringer -type=TagType -linecomment +//go:generate go tool stringer -type=TagType -linecomment type TagType int diff --git a/internal/httplog/event.go b/internal/httplog/event.go index c6e70a21c..bc215ea19 100644 --- a/internal/httplog/event.go +++ b/internal/httplog/event.go @@ -13,7 +13,7 @@ type Logger interface { type EventKind int -//go:generate go run golang.org/x/tools/cmd/stringer -type=EventKind -linecomment +//go:generate go tool stringer -type=EventKind -linecomment const ( NoEvent EventKind = iota diff --git a/tools/flow/flow.go b/tools/flow/flow.go index cdd6846e3..668b615c6 100644 --- a/tools/flow/flow.go +++ b/tools/flow/flow.go @@ -312,7 +312,7 @@ func mermaidGraph(c *Controller) string { // tasks that send updates. type State int -//go:generate go run golang.org/x/tools/cmd/stringer -type=State +//go:generate go tool stringer -type=State const ( // Waiting indicates a task is blocked on input from another task.