Skip to content

Commit

Permalink
Update to Go 1.24 and some new build errors (#24)
Browse files Browse the repository at this point in the history
* Updating to Go 1.24

* Updating to Go 1.24

* Adding changelog

* Updating changelog

* Adding issueLink

* Ran generate-code

* Doesn't resolve issue

* Fixing go vet issue

* Fixing go vet issue
  • Loading branch information
ryanrolds authored Feb 19, 2025
1 parent b44a11c commit 595cafb
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 28 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ jobs:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- name: Set up Go 1.18
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version-file: "go.mod"

- name: Install Protoc
# this will need to change to v2 when we move to protoc >= 3.20
# protoc version will need to change to minor.patch too
Expand All @@ -39,10 +40,10 @@ jobs:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
- name: Set up Go 1.18
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version-file: "go.mod"
- name: Install Protoc
# this will need to change to v2 when we move to protoc >= 3.20
# protoc version will need to change to minor.patch too
Expand Down
18 changes: 8 additions & 10 deletions anyvendor/anyvendor.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions changelog/v0.2.0/go-124.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
changelog:
- type: BREAKING_CHANGE
description: "Update Go to 1.24"
issueLink: https://github.com/solo-io/solo-projects/issues/7609
resolvesIssue: false
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/solo-io/anyvendor

go 1.18
go 1.24

require (
github.com/envoyproxy/protoc-gen-validate v0.6.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
Expand Down Expand Up @@ -179,6 +180,7 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion pkg/git/vendor_git.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (r *GitRepository) Vendor(cache *GitVendorCache, vendorDir string) error {
copiedFileSuffix := filepath.Join(repoRelativePath, cachedFile[len(cachedRepoDir):])
copiedFile := filepath.Join(vendorDir, copiedFileSuffix)
if _, err := fileCopier.Copy(cachedFile, copiedFile); err != nil {
return eris.Wrapf(err, fmt.Sprintf("Error! %s - unable to copy file %s\n",
return eris.Wrap(err, fmt.Sprintf("Error! %s - unable to copy file %s\n",
err.Error(), cachedFile))
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/manager/gomod.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (m *goModFactory) copy(modules []*moduleWithImports) error {
localPath := strings.TrimPrefix(vendorFile, m.WorkingDirectory+"/")
localFile := filepath.Join(m.WorkingDirectory, anyvendor.DefaultDepDir, mod.module.Path, localPath)
if _, err := m.fileCopier.Copy(vendorFile, localFile); err != nil {
return eris.Wrapf(err, fmt.Sprintf("Error! %s - unable to copy file %s\n",
return eris.Wrap(err, fmt.Sprintf("Error! %s - unable to copy file %s\n",
err.Error(), vendorFile))
}
}
Expand All @@ -184,7 +184,7 @@ func (m *goModFactory) copy(modules []*moduleWithImports) error {
localPath := filepath.Join(mod.module.Path, vendorFile[len(mod.module.Dir):])
localFile := filepath.Join(m.WorkingDirectory, anyvendor.DefaultDepDir, localPath)
if _, err := m.fileCopier.Copy(vendorFile, localFile); err != nil {
return eris.Wrapf(err, fmt.Sprintf("Error! %s - unable to copy file %s\n",
return eris.Wrap(err, fmt.Sprintf("Error! %s - unable to copy file %s\n",
err.Error(), vendorFile))
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/manager/protodep.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (
)

/*
An internal only interface used to represent the different types of available sources
for non-go vendored files.
An internal only interface used to represent the different types of available sources
for non-go vendored files.
*/
type depFactory interface {
Ensure(ctx context.Context, opts *anyvendor.Config) error
}

/*
The manager is the external facing object that will be responsible for ensuring
a given anyvendor config, as outlined by the `anyvendor.Config` object.
The manager is the external facing object that will be responsible for ensuring
a given anyvendor config, as outlined by the `anyvendor.Config` object.
*/
type Manager struct {
depFactories []depFactory
Expand Down
12 changes: 6 additions & 6 deletions pkg/modutils/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ var (
)

/*
Returns the current go mod package name from the go.mod file.
Use the function below to get the filename
Ex: github.com/solo-io/solo-kit
Returns the current go mod package name from the go.mod file.
Use the function below to get the filename
Ex: github.com/solo-io/solo-kit
*/
func GetCurrentModPackageName(module string) (string, error) {
f, err := os.Open(module)
Expand All @@ -45,10 +45,10 @@ func GetCurrentModPackageName(module string) (string, error) {
}

/*
Returns the current go mod package
Ex: /path/to/solo-kit/go.mod
Returns the current go mod package
Ex: /path/to/solo-kit/go.mod
Will return /dev/null on unix if not in a go.mod package
Will return /dev/null on unix if not in a go.mod package
*/
func GetCurrentModPackageFile() (string, error) {
cmd := exec.Command("go", "env", "GOMOD")
Expand Down

0 comments on commit 595cafb

Please sign in to comment.