diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 67abd6bf1..da7293547 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: os: ["ubuntu-latest", "windows-latest"] - go: ["1.21.x", "1.22.x"] + go: ["1.22.x", "1.23.x"] steps: - name: Checkout code @@ -52,7 +52,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: 1.22.x + go-version: 1.23.x - name: Test run: make cover COVER_MODULES=./docs @@ -68,7 +68,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: 1.22.x + go-version: 1.23.x cache: false # managed by golangci-lint - uses: golangci/golangci-lint-action@v6 diff --git a/app_121_test.go b/app_121_test.go deleted file mode 100644 index 48c22d305..000000000 --- a/app_121_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2024 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -//go:build !go1.22 -// +build !go1.22 - -package fx_test - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - . "go.uber.org/fx" -) - -func TestNopLoggerOptionString(t *testing.T) { - t.Parallel() - - assert.Equal(t, - "fx.WithLogger(go.uber.org/fx.glob..func1())", - NopLogger.String(), - ) -} diff --git a/app_122_test.go b/app_122_test.go deleted file mode 100644 index 2f6b91ccc..000000000 --- a/app_122_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2024 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -//go:build go1.22 -// +build go1.22 - -package fx_test - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - . "go.uber.org/fx" -) - -func TestNopLoggerOptionString(t *testing.T) { - t.Parallel() - - assert.Equal(t, - "fx.WithLogger(go.uber.org/fx.init.func1())", - NopLogger.String(), - ) -} diff --git a/app_test.go b/app_test.go index 198000cdc..623acad47 100644 --- a/app_test.go +++ b/app_test.go @@ -2397,6 +2397,15 @@ func TestNopLogger(t *testing.T) { app.RequireStart().RequireStop() } +func TestNopLoggerOptionString(t *testing.T) { + t.Parallel() + + assert.Equal(t, + "fx.WithLogger(go.uber.org/fx.init.func1())", + NopLogger.String(), + ) +} + func TestCustomLoggerWithPrinter(t *testing.T) { t.Parallel() diff --git a/internal/fxreflect/stack_120_test.go b/internal/fxreflect/stack_120_test.go deleted file mode 100644 index 5e6d0b762..000000000 --- a/internal/fxreflect/stack_120_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2023 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -//go:build !go1.21 -// +build !go1.21 - -package fxreflect - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestDeepStack(t *testing.T) { - t.Run("nest", func(t *testing.T) { - // Introduce a few frames. - frames := func() []Frame { - return func() []Frame { - return CallerStack(0, 0) - }() - }() - - require.True(t, len(frames) > 3, "expected at least three frames") - for i, name := range []string{"func1.1.1", "func1.1", "func1"} { - f := frames[i] - assert.Equal(t, "go.uber.org/fx/internal/fxreflect.TestDeepStack."+name, f.Function) - assert.Contains(t, f.File, "internal/fxreflect/stack_120_test.go") - assert.NotZero(t, f.Line) - } - }) -} diff --git a/internal/fxreflect/stack_121_test.go b/internal/fxreflect/stack_121_test.go deleted file mode 100644 index 832ed1b4f..000000000 --- a/internal/fxreflect/stack_121_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2023 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -//go:build (go1.21 && !go1.22) -// +build go1.21,!go1.22 - -package fxreflect - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestDeepStack(t *testing.T) { - t.Run("nest", func(t *testing.T) { - // Introduce a few frames. - frames := func() []Frame { - return func() []Frame { - return CallerStack(0, 0) - }() - }() - - require.True(t, len(frames) > 3, "expected at least three frames") - for i, name := range []string{"func1.TestDeepStack.func1.1.func2", "func1.1", "func1"} { - f := frames[i] - assert.Equal(t, "go.uber.org/fx/internal/fxreflect.TestDeepStack."+name, f.Function) - assert.Contains(t, f.File, "internal/fxreflect/stack_121_test.go") - assert.NotZero(t, f.Line) - } - }) -} diff --git a/internal/fxreflect/stack_122_test.go b/internal/fxreflect/stack_122_test.go deleted file mode 100644 index c3976bf5f..000000000 --- a/internal/fxreflect/stack_122_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2023 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -//go:build go1.22 -// +build go1.22 - -package fxreflect - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestDeepStack(t *testing.T) { - t.Run("nest", func(t *testing.T) { - // Introduce a few frames. - frames := func() []Frame { - return func() []Frame { - return CallerStack(0, 0) - }() - }() - - require.True(t, len(frames) > 3, "expected at least three frames") - for i, name := range []string{"func1.TestDeepStack.func1.1.2", "func1.1", "func1"} { - f := frames[i] - assert.Equal(t, "go.uber.org/fx/internal/fxreflect.TestDeepStack."+name, f.Function) - assert.Contains(t, f.File, "internal/fxreflect/stack_122_test.go") - assert.NotZero(t, f.Line) - } - }) -} diff --git a/internal/fxreflect/stack_test.go b/internal/fxreflect/stack_test.go index c5eb8c949..b3ce56147 100644 --- a/internal/fxreflect/stack_test.go +++ b/internal/fxreflect/stack_test.go @@ -65,6 +65,25 @@ func TestStack(t *testing.T) { }) } +func TestDeepStack(t *testing.T) { + t.Run("nest", func(t *testing.T) { + // Introduce a few frames. + frames := func() []Frame { + return func() []Frame { + return CallerStack(0, 0) + }() + }() + + require.True(t, len(frames) > 3, "expected at least three frames") + for i, name := range []string{"func1.TestDeepStack.func1.1.2", "func1.1", "func1"} { + f := frames[i] + assert.Equal(t, "go.uber.org/fx/internal/fxreflect.TestDeepStack."+name, f.Function) + assert.Contains(t, f.File, "internal/fxreflect/stack_test.go") + assert.NotZero(t, f.Line) + } + }) +} + func TestStackCallerName(t *testing.T) { t.Parallel()