Skip to content

Commit 8fa8bd1

Browse files
committed
add SKIP_VERSION_UPGRADE setting to skip version upgrade
1 parent dda5ec0 commit 8fa8bd1

File tree

7 files changed

+35
-28
lines changed

7 files changed

+35
-28
lines changed

.github/workflows/lint.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: actions/checkout@v4
2020
- uses: actions/setup-go@v5
2121
with:
22-
go-version: "1.21"
22+
go-version: "1.22"
2323
- name: Install dependencies
2424
run: |
2525
go get -t -v ./...

.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: actions/checkout@v4
1818
- uses: actions/setup-go@v5
1919
with:
20-
go-version: "1.21"
20+
go-version: "1.22"
2121
- name: build the CLI
2222
run: |
2323
VERSION="$GITHUB_REF_NAME" make ci-build-codegen

.github/workflows/test.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: actions/checkout@v4
2525
- uses: actions/setup-go@v5
2626
with:
27-
go-version: "1.21"
27+
go-version: "1.22"
2828
- name: Install dependencies
2929
run: |
3030
go get -t -v ./...

cmd/hasura-ndc-go/command/internal/connector.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ import (
2323

2424
// ConnectorGenerationArguments represent input arguments of the ConnectorGenerator.
2525
type ConnectorGenerationArguments struct {
26-
Path string `help:"The path of the root directory where the go.mod file is present" short:"p" env:"HASURA_PLUGIN_CONNECTOR_CONTEXT_PATH" default:"."`
27-
ConnectorDir string `help:"The directory where the connector.go file is placed" default:"."`
28-
Directories []string `help:"Folders contain NDC operation functions" short:"d"`
29-
Trace string `help:"Enable tracing and write to target file path."`
30-
SchemaFormat string `help:"The output format for the connector schema. Accept: json, go" enum:"json,go" default:"json"`
31-
Style string `help:"The naming style for functions and procedures. Accept: camel-case, snake-case" enum:"camel-case,snake-case" default:"camel-case"`
32-
TypeOnly bool `help:"Generate type only" default:"false"`
26+
Path string `help:"The path of the root directory where the go.mod file is present" short:"p" env:"HASURA_PLUGIN_CONNECTOR_CONTEXT_PATH" default:"."`
27+
ConnectorDir string `help:"The directory where the connector.go file is placed" default:"."`
28+
Directories []string `help:"Folders contain NDC operation functions" short:"d"`
29+
Trace string `help:"Enable tracing and write to target file path."`
30+
SchemaFormat string `help:"The output format for the connector schema. Accept: json, go" enum:"json,go" default:"json"`
31+
Style string `help:"The naming style for functions and procedures. Accept: camel-case, snake-case" enum:"camel-case,snake-case" default:"camel-case"`
32+
TypeOnly bool `help:"Generate type only" default:"false"`
33+
SkipVersionUpgrade bool `help:"Skip upgrading the SDK version. You need to upgrade manually if required" env:"SKIP_VERSION_UPGRADE" default:"false"`
3334
}
3435

3536
type connectorTypeBuilder struct {

cmd/hasura-ndc-go/command/update.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,19 @@ func UpdateConnectorSchema(args UpdateArguments, start time.Time) {
3232
log.Fatal().Err(err).Msg("failed to generate connector schema")
3333
}
3434

35-
if err := execGetLatestSDK("."); err != nil {
36-
log.Error().Err(err).Msg("failed to upgrade the latest SDK version")
37-
}
38-
if err := execGoModTidy("."); err != nil {
39-
log.Error().Err(err).Msg("failed to tidy modules")
35+
if !args.SkipVersionUpgrade {
36+
if err := execGetLatestSDK("."); err != nil {
37+
log.Error().Err(err).Msg("failed to upgrade the latest SDK version")
38+
}
39+
if err := execGoModTidy("."); err != nil {
40+
log.Error().Err(err).Msg("failed to tidy modules")
41+
}
4042
}
43+
4144
if err := execGoFormat("."); err != nil {
4245
log.Error().Err(err).Msg("failed to format code")
4346
}
47+
4448
log.Info().Str("exec_time", time.Since(start).Round(time.Millisecond).String()).
4549
Msg("generated successfully")
4650
}

cmd/hasura-ndc-go/go.mod

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module github.com/hasura/ndc-sdk-go/cmd/hasura-ndc-go
22

3-
go 1.21
3+
go 1.22.0
4+
5+
toolchain go1.24.0
46

57
require (
68
github.com/alecthomas/kong v1.8.1
@@ -9,8 +11,8 @@ require (
911
github.com/hasura/ndc-sdk-go v1.5.0
1012
github.com/iancoleman/strcase v0.3.0
1113
github.com/rs/zerolog v1.33.0
12-
golang.org/x/mod v0.20.0
13-
golang.org/x/tools v0.24.0
14+
golang.org/x/mod v0.23.0
15+
golang.org/x/tools v0.30.0
1416
gotest.tools/v3 v3.5.2
1517
)
1618

@@ -20,6 +22,6 @@ require (
2022
github.com/mattn/go-colorable v0.1.13 // indirect
2123
github.com/mattn/go-isatty v0.0.20 // indirect
2224
go.opentelemetry.io/otel v1.29.0 // indirect
23-
golang.org/x/sync v0.10.0 // indirect
24-
golang.org/x/sys v0.25.0 // indirect
25+
golang.org/x/sync v0.11.0 // indirect
26+
golang.org/x/sys v0.30.0 // indirect
2527
)

cmd/hasura-ndc-go/go.sum

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
3838
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
3939
go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw=
4040
go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8=
41-
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
42-
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
43-
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
44-
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
41+
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
42+
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
43+
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
44+
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
4545
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4646
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4747
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
48-
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
49-
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
50-
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
51-
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
48+
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
49+
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
50+
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
51+
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
5252
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
5353
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
5454
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=

0 commit comments

Comments
 (0)