-
Notifications
You must be signed in to change notification settings - Fork 3
Fix #23 #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix #23 #24
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| --- | ||
| name: Test and Vet (go directive version) | ||
|
|
||
| env: | ||
| GOTOOLCHAIN: local | ||
|
|
||
| "on": | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| release: | ||
| types: | ||
| - published | ||
| - created | ||
| - edited | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| steps: | ||
|
|
||
| - name: Checkout code | ||
| uses: actions/checkout@v4.2.2 | ||
|
|
||
| - name: Install Go | ||
| uses: actions/setup-go@v5.3.0 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
|
|
||
| - name: Cache Go module and build cache | ||
| uses: actions/cache@v4.2.2 | ||
| with: | ||
| key: go-${{ hashFiles('**/go.sum') }} | ||
| path: | | ||
| ~/go/pkg/mod | ||
| restore-keys: | | ||
| go- | ||
|
|
||
| - name: Install tennvet | ||
| run: | | ||
| GOBIN=$(pwd) go install github.com/tenntenn/tennvet@latest | ||
|
|
||
| - name: Test and vet | ||
| run: | | ||
| go version | ||
| go vet ./... | ||
| go vet -vettool=$(pwd)/tennvet ./... | ||
| go test -v -race ./... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| name: Test and Vet (toolchain directive version) | ||
|
|
||
| env: | ||
| GOTOOLCHAIN: local | ||
|
|
||
| "on": | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| release: | ||
| types: | ||
| - published | ||
| - created | ||
| - edited | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| steps: | ||
|
|
||
| - name: Checkout code | ||
| uses: actions/checkout@v4.2.2 | ||
|
|
||
| - name: Parse toolchain directive | ||
| # see: https://github.com/actions/setup-go/issues/457 | ||
| id: toolchain | ||
| run: | | ||
| echo "version=$(sed -ne '/^toolchain /s/^toolchain go//p' go.mod)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Install Go | ||
| uses: actions/setup-go@v5.3.0 | ||
| with: | ||
| go-version: ${{ steps.toolchain.outputs.version }} | ||
|
|
||
| - name: Cache Go module and build cache | ||
| uses: actions/cache@v4.2.2 | ||
| with: | ||
| key: go-${{ hashFiles('**/go.sum') }} | ||
| path: | | ||
| ~/go/pkg/mod | ||
| restore-keys: | | ||
| go- | ||
|
|
||
| - name: Install tennvet | ||
| run: | | ||
| GOBIN=$(pwd) go install github.com/tenntenn/tennvet@latest | ||
|
|
||
| - name: Test and vet | ||
| run: | | ||
| go version | ||
| go vet ./... | ||
| go vet -vettool=$(pwd)/tennvet ./... | ||
| go test -v -race ./... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| //go:build go1.24 | ||
|
|
||
| package testutil | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "testing" | ||
| ) | ||
|
|
||
| // Remove tool directive from go.mod. | ||
| func removeToolDirective(tb testing.TB, dir string) { | ||
| tb.Helper() | ||
|
|
||
| r := execCmd(tb, dir, "go", "mod", "edit", "-json") | ||
| var modfile struct { | ||
| Tool []struct { | ||
| Path string | ||
| } | ||
| } | ||
| if err := json.NewDecoder(r).Decode(&modfile); err != nil { | ||
| tb.Fatal("unexpected error:", err) | ||
| } | ||
|
|
||
| for _, tool := range modfile.Tool { | ||
| execCmd(tb, dir, "go", "mod", "edit", "-droptool", tool.Path) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| //go:build go1.24 | ||
|
|
||
| package issuetest | ||
|
|
||
| import ( | ||
| "flag" | ||
| "path/filepath" | ||
| "testing" | ||
|
|
||
| "github.com/tenntenn/golden" | ||
| "golang.org/x/tools/go/analysis/analysistest" | ||
|
|
||
| "github.com/gostaticanalysis/testutil" | ||
| ) | ||
|
|
||
| var flagGoldenUpdate bool | ||
|
|
||
| func init() { | ||
| flag.BoolVar(&flagGoldenUpdate, "update-golden", false, "update golden files") | ||
| } | ||
|
|
||
| func TestIssue00023(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| testdata := analysistest.TestData() | ||
| target := filepath.Join(testdata, "target") | ||
| tmpdir := testutil.WithModules(t, target, nil) | ||
| got := golden.Txtar(t, tmpdir) | ||
| if diff := golden.Check(t, flagGoldenUpdate, testdata, t.Name(), got); diff != "" { | ||
| t.Errorf("golden file mismatch: (-want, +got) = %s", diff) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| -- src/issue00023/go.mod -- | ||
| module example.com/issue00023 | ||
|
|
||
| go 1.24.1 | ||
| -- src/issue00023/go.sum -- | ||
| -- src/issue00023/issue00023.go -- | ||
| //line issue00023.go:1 | ||
|
|
||
| //go:build go1.24 | ||
|
|
||
| // see https://github.com/gostaticanalysis/testutil/blob/main/go.mod | ||
| package issue00023 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| module example.com/issue00023 | ||
|
|
||
| go 1.24.1 | ||
|
|
||
| require ( | ||
| cel.dev/expr v0.18.0 // indirect | ||
| filippo.io/edwards25519 v1.1.0 // indirect | ||
| github.com/antlr4-go/antlr/v4 v4.13.1 // indirect | ||
| github.com/cubicdaiya/gonp v1.0.4 // indirect | ||
| github.com/davecgh/go-spew v1.1.1 // indirect | ||
| github.com/dustin/go-humanize v1.0.1 // indirect | ||
| github.com/fatih/structtag v1.2.0 // indirect | ||
| github.com/go-sql-driver/mysql v1.8.1 // indirect | ||
| github.com/google/cel-go v0.22.1 // indirect | ||
| github.com/google/uuid v1.6.0 // indirect | ||
| github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
| github.com/jackc/pgpassfile v1.0.0 // indirect | ||
| github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect | ||
| github.com/jackc/pgx/v5 v5.7.2 // indirect | ||
| github.com/jackc/puddle/v2 v2.2.2 // indirect | ||
| github.com/jinzhu/inflection v1.0.0 // indirect | ||
| github.com/mattn/go-isatty v0.0.20 // indirect | ||
| github.com/ncruces/go-strftime v0.1.9 // indirect | ||
| github.com/pganalyze/pg_query_go/v5 v5.1.0 // indirect | ||
| github.com/pingcap/errors v0.11.5-0.20240311024730-e056997136bb // indirect | ||
| github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 // indirect | ||
| github.com/pingcap/log v1.1.0 // indirect | ||
| github.com/pingcap/tidb/pkg/parser v0.0.0-20241203170126-9812d85d0d25 // indirect | ||
| github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect | ||
| github.com/riza-io/grpc-go v0.2.0 // indirect | ||
| github.com/spf13/cobra v1.8.1 // indirect | ||
| github.com/spf13/pflag v1.0.5 // indirect | ||
| github.com/sqlc-dev/sqlc v1.28.0 // indirect | ||
| github.com/stoewer/go-strcase v1.2.0 // indirect | ||
| github.com/tetratelabs/wazero v1.8.2 // indirect | ||
| github.com/wasilibs/go-pgquery v0.0.0-20240606042535-c0843d6592cc // indirect | ||
| github.com/wasilibs/wazero-helpers v0.0.0-20240604052452-61d7981e9a38 // indirect | ||
| go.uber.org/atomic v1.11.0 // indirect | ||
| go.uber.org/multierr v1.11.0 // indirect | ||
| go.uber.org/zap v1.27.0 // indirect | ||
| golang.org/x/crypto v0.31.0 // indirect | ||
| golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect | ||
| golang.org/x/net v0.33.0 // indirect | ||
| golang.org/x/sync v0.10.0 // indirect | ||
| golang.org/x/sys v0.28.0 // indirect | ||
| golang.org/x/text v0.21.0 // indirect | ||
| google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 // indirect | ||
| google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect | ||
| google.golang.org/grpc v1.69.4 // indirect | ||
| google.golang.org/protobuf v1.36.3 // indirect | ||
| gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect | ||
| gopkg.in/yaml.v3 v3.0.1 // indirect | ||
| modernc.org/libc v1.55.3 // indirect | ||
| modernc.org/mathutil v1.6.0 // indirect | ||
| modernc.org/memory v1.8.0 // indirect | ||
| modernc.org/sqlite v1.34.5 // indirect | ||
| ) | ||
|
|
||
| tool github.com/sqlc-dev/sqlc/cmd/sqlc |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that the
goldenmodule is directly imported in this file, but it's listed as an indirect dependency in thego.modfile. Is this intentional?