Skip to content

Commit

Permalink
[chore] Bump Go to 1.20 (#475)
Browse files Browse the repository at this point in the history
* [chore] Update minimum go version to 1.20

Signed-off-by: Erik Westra <e.s.westra.95@gmail.com>

* Update bump-go-1.20.yaml

---------

Signed-off-by: Erik Westra <e.s.westra.95@gmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
  • Loading branch information
webstradev and pellared authored Dec 28, 2023
1 parent 41b2c05 commit 18ffba2
Show file tree
Hide file tree
Showing 41 changed files with 76 additions and 60 deletions.
16 changes: 16 additions & 0 deletions .chloggen/bump-go-1.20.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'breaking'

# The name of the component, or a single word describing the area of concern, (e.g. crosslink)
component: all

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "bump minimal Go version to 1.20"

# One or more tracking issues related to the change
issues: [474]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
2 changes: 1 addition & 1 deletion checkfile/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/build-tools/checkfile

go 1.19
go 1.20

require github.com/stretchr/testify v1.8.4

Expand Down
2 changes: 1 addition & 1 deletion chloggen/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/build-tools/chloggen

go 1.19
go 1.20

require (
github.com/spf13/cobra v1.8.0
Expand Down
2 changes: 1 addition & 1 deletion crosslink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,6 @@ for out-dated intra-repository Go modules.

### --go

Go version applied when new `go.work` file is created (default "1.19").
Go version applied when new `go.work` file is created (default "1.20").

crosslink work --go=1.20
2 changes: 1 addition & 1 deletion crosslink/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func init() {
comCfg.rootCommand.Flags().BoolVarP(&comCfg.runConfig.Prune, "prune", "p", false, "enables pruning operations on all go.mod files inside root repository")
comCfg.pruneCommand.Flags().StringSliceVar(&comCfg.excludeFlags, "exclude", []string{}, "list of comma separated go modules that crosslink will ignore in operations."+
"multiple calls of --exclude can be made")
comCfg.workCommand.Flags().StringVar(&comCfg.runConfig.GoVersion, "go", "1.19", "Go version applied when new go.work file is created")
comCfg.workCommand.Flags().StringVar(&comCfg.runConfig.GoVersion, "go", "1.20", "Go version applied when new go.work file is created")
}

// transform array slice into map
Expand Down
2 changes: 1 addition & 1 deletion crosslink/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/build-tools/crosslink

go 1.19
go 1.20

require (
github.com/google/go-cmp v0.6.0
Expand Down
36 changes: 18 additions & 18 deletions crosslink/internal/crosslink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestCrosslink(t *testing.T) {
config: DefaultRunConfig(),
expected: map[string][]byte{
"go.mod": []byte("module go.opentelemetry.io/build-tools/crosslink/testroot\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0\n" +
")\n" +
Expand All @@ -52,13 +52,13 @@ func TestCrosslink(t *testing.T) {
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testZ => ./testZ\n\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ./testB"),
filepath.Join("testA", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testA\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0\n" +
")\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ../testB"),
filepath.Join("testB", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testB\n\n" +
"go 1.19\n\n"),
"go 1.20\n\n"),
},
},
{
Expand All @@ -67,22 +67,22 @@ func TestCrosslink(t *testing.T) {
config: DefaultRunConfig(),
expected: map[string][]byte{
"go.mod": []byte("module go.opentelemetry.io/build-tools/crosslink/testroot\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0\n" +
")\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testA => ./testA\n\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ./testB"),
filepath.Join("testA", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testA\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0\n" +
")\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ../testB\n\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot => ../"),
// b has req on root but not necessary to write out with current comparison logic
filepath.Join("testB", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testB\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testA => ../testA\n\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot => ../\n\n"),
},
Expand All @@ -96,20 +96,20 @@ func TestCrosslink(t *testing.T) {
},
expected: map[string][]byte{
"go.mod": []byte("module go.opentelemetry.io/build-tools/crosslink/testroot\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0\n" +
")\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testA => ./testA\n\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ./testB"),
filepath.Join("testA", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testA\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0\n" +
")\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ../testB"),
filepath.Join("testB", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testB\n\n" +
"go 1.19\n\n"),
"go 1.20\n\n"),
},
},
}
Expand Down Expand Up @@ -188,20 +188,20 @@ func TestOverwrite(t *testing.T) {
},
expected: map[string][]byte{
"go.mod": []byte("module go.opentelemetry.io/build-tools/crosslink/testroot\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0\n" +
")\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testA => ./testA\n\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ./testB"),
filepath.Join("testA", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testA\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0\n" +
")\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ../testB"),
filepath.Join("testB", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testB\n\n" +
"go 1.19\n\n"),
"go 1.20\n\n"),
},
},
{
Expand All @@ -213,20 +213,20 @@ func TestOverwrite(t *testing.T) {
},
expected: map[string][]byte{
"go.mod": []byte("module go.opentelemetry.io/build-tools/crosslink/testroot\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0\n" +
")\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testA => ../testA\n\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ./testB"),
filepath.Join("testA", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testA\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0\n" +
")\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ../testB"),
filepath.Join("testB", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testB\n\n" +
"go 1.19\n\n"),
"go 1.20\n\n"),
},
},
}
Expand Down Expand Up @@ -352,20 +352,20 @@ func TestExclude(t *testing.T) {
// a mock_test_data_expected folder could be built instead of building expected files by hand.
modFilesExpected := map[string][]byte{
filepath.Join(tmpRootDir, "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0\n" +
")\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testA => ../testA\n\n" +
"replace go.opentelemetry.io/build-tools/excludeme => ../excludeme\n\n"),
filepath.Join(tmpRootDir, "testA", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testA\n\n" +
"go 1.19\n\n" +
"go 1.20\n\n" +
"require (\n\t" +
"go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0\n" +
")\n" +
"replace go.opentelemetry.io/build-tools/crosslink/testroot/testB => ../testB"),
filepath.Join(tmpRootDir, "testB", "go.mod"): []byte("module go.opentelemetry.io/build-tools/crosslink/testroot/testB\n\n" +
"go 1.19\n\n"),
"go 1.20\n\n"),
}

for modFilePath, modFilesExpected := range modFilesExpected {
Expand Down
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testCyclic/gomod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module go.opentelemetry.io/build-tools/crosslink/testroot

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testCyclic/testA/gomod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testA

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testCyclic/testB/gomod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testB

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot v1.0.0
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testExclude/gomod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/build-tools/crosslink/testroot

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0

Expand Down
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testExclude/testA/gomod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testA

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0

Expand Down
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testExclude/testB/gomod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testB

go 1.19
go 1.20
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testNoOverwrite/gomod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/build-tools/crosslink/testroot

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testA

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testB

go 1.19
go 1.20
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testOverwrite/gomod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/build-tools/crosslink/testroot

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testA

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testB

go 1.19
go 1.20
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testPrune/gomod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/build-tools/crosslink/testroot

go 1.19
go 1.20

require (
go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testSimple/gomod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/build-tools/crosslink/testroot

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0

Expand Down
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testSimple/testA/gomod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testA

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testSimple/testB/gomod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testB

go 1.19
go 1.20
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testSimplePrune/gomod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/build-tools/crosslink/testroot

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testA v1.0.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testA

go 1.19
go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testB v1.0.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testB

go 1.19
go 1.20
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testWork/go.work
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.19
go 1.20

// existing valid use statements under root should remain
use ./testA
Expand Down
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testWork/gomod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go.opentelemetry.io/build-tools/crosslink/testroot

go 1.19
go 1.20
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testWork/testA/gomod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testA

go 1.19
go 1.20
2 changes: 1 addition & 1 deletion crosslink/internal/mock_test_data/testWork/testB/gomod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testB

go 1.19
go 1.20
Loading

0 comments on commit 18ffba2

Please sign in to comment.