Skip to content

Commit

Permalink
cmd: should upgrade the latest SDK after introspection (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiasac authored Oct 7, 2024
1 parent 6d47f47 commit e6a7fd8
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ go 1.21
require (
github.com/google/uuid v1.6.0
github.com/hasura/ndc-sdk-go v1.4.1
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/trace v1.28.0
golang.org/x/sync v0.8.0
)

require (
Expand All @@ -26,6 +23,7 @@ require (
github.com/prometheus/common v0.59.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.28.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
Expand All @@ -35,6 +33,7 @@ require (
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ module github.com/hasura/ndc-codegen-empty-test

go 1.21

require (
github.com/hasura/ndc-sdk-go v1.4.1
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/trace v1.28.0
golang.org/x/sync v0.8.0
)
require github.com/hasura/ndc-sdk-go v1.4.1

require (
github.com/alecthomas/kong v1.2.1 // indirect
Expand All @@ -26,6 +21,7 @@ require (
github.com/prometheus/common v0.59.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.28.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
Expand All @@ -35,6 +31,7 @@ require (
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
Expand Down
4 changes: 4 additions & 0 deletions cmd/hasura-ndc-go/command/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ func generateNewProjectFiles(args *NewArguments, srcPath string) error {
})
}

func execGetLatestSDK(basePath string) error {
return execCommand(basePath, "go", "get", "github.com/hasura/ndc-sdk-go@v1")
}

func execGoModTidy(basePath string) error {
return execCommand(basePath, "go", "mod", "tidy")
}
Expand Down
9 changes: 8 additions & 1 deletion cmd/hasura-ndc-go/command/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@ func UpdateConnectorSchema(args UpdateArguments, start time.Time) {
if err = internal.ParseAndGenerateConnector(internal.ConnectorGenerationArguments(args), moduleName); err != nil {
log.Fatal().Err(err).Msg("failed to generate connector schema")
}

if err := execGetLatestSDK("."); err != nil {
log.Error().Err(err).Msg("failed to upgrade the latest SDK version")
}
if err := execGoModTidy("."); err != nil {
log.Error().Err(err).Msg("failed to tidy modules")
}
if err := execGoFormat("."); err != nil {
log.Fatal().Err(err).Msg("failed to format code")
log.Error().Err(err).Msg("failed to format code")
}
log.Info().Str("exec_time", time.Since(start).Round(time.Millisecond).String()).
Msg("generated successfully")
Expand Down
2 changes: 1 addition & 1 deletion cmd/hasura-ndc-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/alecthomas/kong v1.2.1
github.com/fatih/structtag v1.2.0
github.com/google/uuid v1.6.0
github.com/hasura/ndc-sdk-go v1.4.0
github.com/hasura/ndc-sdk-go v1.5.0
github.com/iancoleman/strcase v0.3.0
github.com/rs/zerolog v1.33.0
golang.org/x/mod v0.20.0
Expand Down
4 changes: 2 additions & 2 deletions cmd/hasura-ndc-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hasura/ndc-sdk-go v1.4.0 h1:RdkQm0efQfhDOxp/Gb1sLyOPh/q3XM7n1oOVKoG/rms=
github.com/hasura/ndc-sdk-go v1.4.0/go.mod h1:1DV7DoWoCrBdsyg/eSkdRxuvQJRySmyzdpcvFUmDoGo=
github.com/hasura/ndc-sdk-go v1.5.0 h1:KvfzbrWBDrs21oz1xA0BvWNhKRqAX0NqLCfPyKz+l/M=
github.com/hasura/ndc-sdk-go v1.5.0/go.mod h1:oik0JrwuN5iZwZjZJzIRMw9uO2xDJbCXwhS1GgaRejk=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
Expand Down
2 changes: 1 addition & 1 deletion example/codegen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
require (
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
github.com/hasura/ndc-sdk-go v1.4.0
github.com/hasura/ndc-sdk-go v1.5.0
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/trace v1.28.0
golang.org/x/sync v0.8.0
Expand Down

0 comments on commit e6a7fd8

Please sign in to comment.