Skip to content

Commit 677fa94

Browse files
Bump minimum Go version to 1.18 (#262)
This means we can use generics and various other things. I didn't use any of them yet, this is just bumping the numbers. I added tests for 1.20, and fixed one small bug, I think caused by `go/packages` changes therein. And I bumped the golangci-lint version too while I was in the area. Fixes #256, fixes #257. I have: - [x] Written a clear PR title and description (above) - [x] Signed the [Khan Academy CLA](https://www.khanacademy.org/r/cla) - [x] Added tests covering my changes, if applicable - [x] Included a link to the issue fixed, if applicable - [x] Included documentation, for new features - [x] Added an entry to the changelog
1 parent ff44aa0 commit 677fa94

File tree

8 files changed

+402
-803
lines changed

8 files changed

+402
-803
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
go: [ '1.16', '1.17', '1.18', '1.19' ]
15+
go: [ '1.18', '1.19', '1.20' ]
1616

1717
steps:
1818
- name: Set up Go
@@ -42,4 +42,4 @@ jobs:
4242
- name: Run lint
4343
uses: golangci/golangci-lint-action@v2
4444
with:
45-
version: v1.48 # should match internal/lint/go.mod
45+
version: v1.52.2 # should match internal/lint/go.mod

.golangci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@ linters:
77
disable-all: true
88
enable:
99
# golangci enables these by default.
10-
- deadcode
1110
- errcheck
1211
- gofumpt # (replaces gofmt)
1312
- gosimple
1413
- govet
1514
- ineffassign
1615
- staticcheck
17-
- structcheck
1816
- typecheck
1917
- unused
20-
- varcheck
2118
# golangci disables these by default, but we use them.
2219
- bodyclose
2320
- depguard

docs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ When releasing a new version:
2222

2323
### Breaking changes:
2424

25+
- genqlient now requires Go 1.18 or higher.
26+
2527
### New features:
2628

2729
- You can now bind all types from a package in `genqlient.yaml` using the new `package_bindings` option.

generate/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (c *Config) ValidateAndFillDefaults(baseDir string) error {
127127
binding.Package)
128128
}
129129

130-
mode := packages.NeedImports | packages.NeedTypes | packages.NeedTypesSizes
130+
mode := packages.NeedDeps | packages.NeedTypes
131131
pkgs, err := packages.Load(&packages.Config{
132132
Mode: mode,
133133
}, binding.Package)
@@ -141,7 +141,7 @@ func (c *Config) ValidateAndFillDefaults(baseDir string) error {
141141

142142
for _, pkg := range pkgs {
143143
p := pkg.Types
144-
if p == nil || p.Scope() == nil {
144+
if p == nil || p.Scope() == nil || p.Scope().Len() == 0 {
145145
return errorf(nil, "unable to bind package %s: no types found", binding.Package)
146146
}
147147

go.mod

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
module github.com/Khan/genqlient
22

3-
go 1.16
3+
go 1.18
44

55
require (
66
github.com/99designs/gqlgen v0.17.2
7-
github.com/agnivade/levenshtein v1.1.1 // indirect
87
github.com/alexflint/go-arg v1.4.2
98
github.com/bradleyjkemp/cupaloy/v2 v2.6.0
109
github.com/stretchr/testify v1.7.0
1110
github.com/vektah/gqlparser/v2 v2.4.5
12-
golang.org/x/sys v0.1.0 // indirect
1311
golang.org/x/tools v0.1.10
1412
gopkg.in/yaml.v2 v2.4.0
1513
)
14+
15+
require (
16+
github.com/agnivade/levenshtein v1.1.1 // indirect
17+
github.com/alexflint/go-scalar v1.0.0 // indirect
18+
github.com/davecgh/go-spew v1.1.1 // indirect
19+
github.com/gorilla/websocket v1.4.2 // indirect
20+
github.com/hashicorp/golang-lru v0.5.0 // indirect
21+
github.com/mitchellh/mapstructure v1.2.3 // indirect
22+
github.com/pmezard/go-difflib v1.0.0 // indirect
23+
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
24+
golang.org/x/sys v0.1.0 // indirect
25+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
26+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
27+
)

go.sum

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/lint/go.mod

Lines changed: 175 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,179 @@
11
module github.com/Khan/genqlient/internal/lint
22

3-
go 1.16
3+
go 1.18
44

55
// Should match golangci-lint version in .github/workflows/go.yml
6-
require github.com/golangci/golangci-lint v1.48.0
6+
require github.com/golangci/golangci-lint v1.52.2
7+
8+
require (
9+
4d63.com/gocheckcompilerdirectives v1.2.1 // indirect
10+
4d63.com/gochecknoglobals v0.2.1 // indirect
11+
github.com/Abirdcfly/dupword v0.0.11 // indirect
12+
github.com/Antonboom/errname v0.1.9 // indirect
13+
github.com/Antonboom/nilnil v0.1.3 // indirect
14+
github.com/BurntSushi/toml v1.2.1 // indirect
15+
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
16+
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect
17+
github.com/Masterminds/semver v1.5.0 // indirect
18+
github.com/OpenPeeDeeP/depguard v1.1.1 // indirect
19+
github.com/alexkohler/prealloc v1.0.0 // indirect
20+
github.com/alingse/asasalint v0.0.11 // indirect
21+
github.com/ashanbrown/forbidigo v1.5.1 // indirect
22+
github.com/ashanbrown/makezero v1.1.1 // indirect
23+
github.com/beorn7/perks v1.0.1 // indirect
24+
github.com/bkielbasa/cyclop v1.2.0 // indirect
25+
github.com/blizzy78/varnamelen v0.8.0 // indirect
26+
github.com/bombsimon/wsl/v3 v3.4.0 // indirect
27+
github.com/breml/bidichk v0.2.4 // indirect
28+
github.com/breml/errchkjson v0.3.1 // indirect
29+
github.com/butuzov/ireturn v0.1.1 // indirect
30+
github.com/cespare/xxhash/v2 v2.1.2 // indirect
31+
github.com/charithe/durationcheck v0.0.10 // indirect
32+
github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect
33+
github.com/curioswitch/go-reassign v0.2.0 // indirect
34+
github.com/daixiang0/gci v0.10.1 // indirect
35+
github.com/davecgh/go-spew v1.1.1 // indirect
36+
github.com/denis-tingaikin/go-header v0.4.3 // indirect
37+
github.com/esimonov/ifshort v1.0.4 // indirect
38+
github.com/ettle/strcase v0.1.1 // indirect
39+
github.com/fatih/color v1.15.0 // indirect
40+
github.com/fatih/structtag v1.2.0 // indirect
41+
github.com/firefart/nonamedreturns v1.0.4 // indirect
42+
github.com/fsnotify/fsnotify v1.5.4 // indirect
43+
github.com/fzipp/gocyclo v0.6.0 // indirect
44+
github.com/go-critic/go-critic v0.7.0 // indirect
45+
github.com/go-toolsmith/astcast v1.1.0 // indirect
46+
github.com/go-toolsmith/astcopy v1.1.0 // indirect
47+
github.com/go-toolsmith/astequal v1.1.0 // indirect
48+
github.com/go-toolsmith/astfmt v1.1.0 // indirect
49+
github.com/go-toolsmith/astp v1.1.0 // indirect
50+
github.com/go-toolsmith/strparse v1.1.0 // indirect
51+
github.com/go-toolsmith/typep v1.1.0 // indirect
52+
github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect
53+
github.com/gobwas/glob v0.2.3 // indirect
54+
github.com/gofrs/flock v0.8.1 // indirect
55+
github.com/golang/protobuf v1.5.2 // indirect
56+
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect
57+
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect
58+
github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect
59+
github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 // indirect
60+
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect
61+
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect
62+
github.com/golangci/misspell v0.4.0 // indirect
63+
github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect
64+
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
65+
github.com/google/go-cmp v0.5.9 // indirect
66+
github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect
67+
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
68+
github.com/gostaticanalysis/comment v1.4.2 // indirect
69+
github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect
70+
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
71+
github.com/hashicorp/errwrap v1.0.0 // indirect
72+
github.com/hashicorp/go-multierror v1.1.1 // indirect
73+
github.com/hashicorp/go-version v1.6.0 // indirect
74+
github.com/hashicorp/hcl v1.0.0 // indirect
75+
github.com/hexops/gotextdiff v1.0.3 // indirect
76+
github.com/inconshreveable/mousetrap v1.0.1 // indirect
77+
github.com/jgautheron/goconst v1.5.1 // indirect
78+
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
79+
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
80+
github.com/julz/importas v0.1.0 // indirect
81+
github.com/junk1tm/musttag v0.5.0 // indirect
82+
github.com/kisielk/errcheck v1.6.3 // indirect
83+
github.com/kisielk/gotool v1.0.0 // indirect
84+
github.com/kkHAIKE/contextcheck v1.1.4 // indirect
85+
github.com/kulti/thelper v0.6.3 // indirect
86+
github.com/kunwardeep/paralleltest v1.0.6 // indirect
87+
github.com/kyoh86/exportloopref v0.1.11 // indirect
88+
github.com/ldez/gomoddirectives v0.2.3 // indirect
89+
github.com/ldez/tagliatelle v0.4.0 // indirect
90+
github.com/leonklingele/grouper v1.1.1 // indirect
91+
github.com/lufeee/execinquery v1.2.1 // indirect
92+
github.com/magiconair/properties v1.8.6 // indirect
93+
github.com/maratori/testableexamples v1.0.0 // indirect
94+
github.com/maratori/testpackage v1.1.1 // indirect
95+
github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect
96+
github.com/mattn/go-colorable v0.1.13 // indirect
97+
github.com/mattn/go-isatty v0.0.17 // indirect
98+
github.com/mattn/go-runewidth v0.0.9 // indirect
99+
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
100+
github.com/mbilski/exhaustivestruct v1.2.0 // indirect
101+
github.com/mgechev/revive v1.3.1 // indirect
102+
github.com/mitchellh/go-homedir v1.1.0 // indirect
103+
github.com/mitchellh/mapstructure v1.5.0 // indirect
104+
github.com/moricho/tparallel v0.3.1 // indirect
105+
github.com/nakabonne/nestif v0.3.1 // indirect
106+
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
107+
github.com/nishanths/exhaustive v0.9.5 // indirect
108+
github.com/nishanths/predeclared v0.2.2 // indirect
109+
github.com/nunnatsa/ginkgolinter v0.9.0 // indirect
110+
github.com/olekukonko/tablewriter v0.0.5 // indirect
111+
github.com/pelletier/go-toml v1.9.5 // indirect
112+
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
113+
github.com/pmezard/go-difflib v1.0.0 // indirect
114+
github.com/polyfloyd/go-errorlint v1.4.0 // indirect
115+
github.com/prometheus/client_golang v1.12.1 // indirect
116+
github.com/prometheus/client_model v0.2.0 // indirect
117+
github.com/prometheus/common v0.32.1 // indirect
118+
github.com/prometheus/procfs v0.7.3 // indirect
119+
github.com/quasilyte/go-ruleguard v0.3.19 // indirect
120+
github.com/quasilyte/gogrep v0.5.0 // indirect
121+
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
122+
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
123+
github.com/ryancurrah/gomodguard v1.3.0 // indirect
124+
github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect
125+
github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect
126+
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
127+
github.com/sashamelentyev/usestdlibvars v1.23.0 // indirect
128+
github.com/securego/gosec/v2 v2.15.0 // indirect
129+
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
130+
github.com/sirupsen/logrus v1.9.0 // indirect
131+
github.com/sivchari/containedctx v1.0.2 // indirect
132+
github.com/sivchari/nosnakecase v1.7.0 // indirect
133+
github.com/sivchari/tenv v1.7.1 // indirect
134+
github.com/sonatard/noctx v0.0.2 // indirect
135+
github.com/sourcegraph/go-diff v0.7.0 // indirect
136+
github.com/spf13/afero v1.8.2 // indirect
137+
github.com/spf13/cast v1.5.0 // indirect
138+
github.com/spf13/cobra v1.6.1 // indirect
139+
github.com/spf13/jwalterweatherman v1.1.0 // indirect
140+
github.com/spf13/pflag v1.0.5 // indirect
141+
github.com/spf13/viper v1.12.0 // indirect
142+
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
143+
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
144+
github.com/stretchr/objx v0.5.0 // indirect
145+
github.com/stretchr/testify v1.8.2 // indirect
146+
github.com/subosito/gotenv v1.4.1 // indirect
147+
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect
148+
github.com/tdakkota/asciicheck v0.2.0 // indirect
149+
github.com/tetafro/godot v1.4.11 // indirect
150+
github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e // indirect
151+
github.com/timonwong/loggercheck v0.9.4 // indirect
152+
github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect
153+
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
154+
github.com/ultraware/funlen v0.0.3 // indirect
155+
github.com/ultraware/whitespace v0.0.5 // indirect
156+
github.com/uudashr/gocognit v1.0.6 // indirect
157+
github.com/yagipy/maintidx v1.0.0 // indirect
158+
github.com/yeya24/promlinter v0.2.0 // indirect
159+
gitlab.com/bosi/decorder v0.2.3 // indirect
160+
go.uber.org/atomic v1.7.0 // indirect
161+
go.uber.org/multierr v1.6.0 // indirect
162+
go.uber.org/zap v1.24.0 // indirect
163+
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
164+
golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect
165+
golang.org/x/mod v0.9.0 // indirect
166+
golang.org/x/sync v0.1.0 // indirect
167+
golang.org/x/sys v0.6.0 // indirect
168+
golang.org/x/text v0.7.0 // indirect
169+
golang.org/x/tools v0.7.0 // indirect
170+
google.golang.org/protobuf v1.28.0 // indirect
171+
gopkg.in/ini.v1 v1.67.0 // indirect
172+
gopkg.in/yaml.v2 v2.4.0 // indirect
173+
gopkg.in/yaml.v3 v3.0.1 // indirect
174+
honnef.co/go/tools v0.4.3 // indirect
175+
mvdan.cc/gofumpt v0.4.0 // indirect
176+
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
177+
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
178+
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect
179+
)

0 commit comments

Comments
 (0)