You've already forked goreleaser
							
							
				mirror of
				https://github.com/goreleaser/goreleaser.git
				synced 2025-10-30 23:58:09 +02:00 
			
		
		
		
	feat: update to go 1.25 (#5971)
- [x] docker image (not released yet) - [x] golangci-lint (not released yet) --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							285a55fa9c
						
					
				
				
					commit
					2b7402fef3
				
			| @@ -10,7 +10,7 @@ By participating in this project, you agree to abide our | ||||
| Prerequisites: | ||||
|  | ||||
| - [Task](https://taskfile.dev/installation) | ||||
| - [Go 1.24+](https://go.dev/doc/install) | ||||
| - [Go 1.25+](https://go.dev/doc/install) | ||||
|  | ||||
| Other things you might need to run some of the tests (they should get | ||||
| automatically skipped if a needed tool isn't present): | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package cmd | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"os" | ||||
| 	"testing" | ||||
|  | ||||
| @@ -54,10 +55,10 @@ func createMainGo(tb testing.TB) { | ||||
|  | ||||
| func goModInit(tb testing.TB) { | ||||
| 	tb.Helper() | ||||
| 	createFile(tb, "go.mod", `module foo | ||||
| 	createFile(tb, "go.mod", fmt.Sprintf(`module foo | ||||
|  | ||||
| go 1.24 | ||||
| `) | ||||
| go %s | ||||
| `, testlib.GoVersion)) | ||||
| } | ||||
|  | ||||
| func createGoReleaserYaml(tb testing.TB) { | ||||
|   | ||||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| module github.com/goreleaser/goreleaser/v2 | ||||
|  | ||||
| go 1.24.6 | ||||
| go 1.25.0 | ||||
|  | ||||
| require ( | ||||
| 	code.gitea.io/sdk/gitea v0.21.0 | ||||
|   | ||||
| @@ -239,9 +239,10 @@ func requireGoMod(tb testing.TB) { | ||||
|  | ||||
| 	mod, err := os.ReadFile("dist/proxy/foo/go.mod") | ||||
| 	require.NoError(tb, err) | ||||
| 	require.Contains(tb, string(mod), `module foo | ||||
| 	require.Contains(tb, string(mod), fmt.Sprintf(`module foo | ||||
|  | ||||
| go 1.24`) | ||||
| go %s | ||||
| `, testlib.GoVersion)) | ||||
| } | ||||
|  | ||||
| func fakeGoModAndSum(tb testing.TB, module string) { | ||||
|   | ||||
| @@ -4,6 +4,7 @@ import ( | ||||
| 	"fmt" | ||||
| 	"sync" | ||||
| 	"testing" | ||||
| 	"testing/synctest" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/goreleaser/goreleaser/v2/internal/pipe" | ||||
| @@ -12,59 +13,68 @@ import ( | ||||
| ) | ||||
|  | ||||
| func TestBlockingFirst(t *testing.T) { | ||||
| 	g := NewBlockingFirst(New(5)) | ||||
| 	var lock sync.Mutex | ||||
| 	var counter int | ||||
| 	for range 10 { | ||||
| 		g.Go(func() error { | ||||
| 			time.Sleep(10 * time.Millisecond) | ||||
| 			lock.Lock() | ||||
| 			defer lock.Unlock() | ||||
| 			counter++ | ||||
| 			return nil | ||||
| 		}) | ||||
| 	} | ||||
| 	require.NoError(t, g.Wait()) | ||||
| 	require.Equal(t, 10, counter) | ||||
| 	synctest.Test(t, func(t *testing.T) { | ||||
| 		t.Helper() | ||||
| 		g := NewBlockingFirst(New(5)) | ||||
| 		var lock sync.Mutex | ||||
| 		var counter int | ||||
| 		for range 10 { | ||||
| 			g.Go(func() error { | ||||
| 				time.Sleep(10 * time.Millisecond) | ||||
| 				lock.Lock() | ||||
| 				defer lock.Unlock() | ||||
| 				counter++ | ||||
| 				return nil | ||||
| 			}) | ||||
| 		} | ||||
| 		require.NoError(t, g.Wait()) | ||||
| 		require.Equal(t, 10, counter) | ||||
| 	}) | ||||
| } | ||||
|  | ||||
| func TestBlockingFirstError(t *testing.T) { | ||||
| 	g := NewBlockingFirst(New(5)) | ||||
| 	var lock sync.Mutex | ||||
| 	var counter int | ||||
| 	for range 10 { | ||||
| 		g.Go(func() error { | ||||
| 			time.Sleep(10 * time.Millisecond) | ||||
| 			lock.Lock() | ||||
| 			defer lock.Unlock() | ||||
| 			if counter == 0 { | ||||
| 				return fmt.Errorf("my error") | ||||
| 			} | ||||
| 			counter++ | ||||
| 			return nil | ||||
| 		}) | ||||
| 	} | ||||
| 	require.EqualError(t, g.Wait(), "my error") | ||||
| 	require.Equal(t, 0, counter) | ||||
| 	synctest.Test(t, func(t *testing.T) { | ||||
| 		t.Helper() | ||||
| 		g := NewBlockingFirst(New(5)) | ||||
| 		var lock sync.Mutex | ||||
| 		var counter int | ||||
| 		for range 10 { | ||||
| 			g.Go(func() error { | ||||
| 				time.Sleep(10 * time.Millisecond) | ||||
| 				lock.Lock() | ||||
| 				defer lock.Unlock() | ||||
| 				if counter == 0 { | ||||
| 					return fmt.Errorf("my error") | ||||
| 				} | ||||
| 				counter++ | ||||
| 				return nil | ||||
| 			}) | ||||
| 		} | ||||
| 		require.EqualError(t, g.Wait(), "my error") | ||||
| 		require.Equal(t, 0, counter) | ||||
| 	}) | ||||
| } | ||||
|  | ||||
| func TestSemaphore(t *testing.T) { | ||||
| 	for _, i := range []int{1, 4} { | ||||
| 		t.Run(fmt.Sprintf("limit-%d", i), func(t *testing.T) { | ||||
| 			g := New(i) | ||||
| 			var lock sync.Mutex | ||||
| 			var counter int | ||||
| 			for range 10 { | ||||
| 				g.Go(func() error { | ||||
| 					time.Sleep(10 * time.Millisecond) | ||||
| 					lock.Lock() | ||||
| 					counter++ | ||||
| 					lock.Unlock() | ||||
| 					return nil | ||||
| 				}) | ||||
| 			} | ||||
| 			require.NoError(t, g.Wait()) | ||||
| 			require.Equal(t, 10, counter) | ||||
| 			synctest.Test(t, func(t *testing.T) { | ||||
| 				t.Helper() | ||||
| 				g := New(i) | ||||
| 				var lock sync.Mutex | ||||
| 				var counter int | ||||
| 				for range 10 { | ||||
| 					g.Go(func() error { | ||||
| 						time.Sleep(10 * time.Millisecond) | ||||
| 						lock.Lock() | ||||
| 						counter++ | ||||
| 						lock.Unlock() | ||||
| 						return nil | ||||
| 					}) | ||||
| 				} | ||||
| 				require.NoError(t, g.Wait()) | ||||
| 				require.Equal(t, 10, counter) | ||||
| 			}) | ||||
| 		}) | ||||
| 	} | ||||
| } | ||||
| @@ -106,16 +116,19 @@ func TestSemaphoreError(t *testing.T) { | ||||
| func TestSemaphoreSkipAware(t *testing.T) { | ||||
| 	for _, i := range []int{1, 4} { | ||||
| 		t.Run(fmt.Sprintf("limit-%d", i), func(t *testing.T) { | ||||
| 			g := NewSkipAware(New(i)) | ||||
| 			for range 10 { | ||||
| 				g.Go(func() error { | ||||
| 					time.Sleep(10 * time.Millisecond) | ||||
| 					return pipe.Skip("fake skip") | ||||
| 				}) | ||||
| 			} | ||||
| 			merr := &multierror.Error{} | ||||
| 			require.ErrorAs(t, g.Wait(), &merr, "must be a multierror") | ||||
| 			require.Len(t, merr.Errors, 10) | ||||
| 			synctest.Test(t, func(t *testing.T) { | ||||
| 				t.Helper() | ||||
| 				g := NewSkipAware(New(i)) | ||||
| 				for range 10 { | ||||
| 					g.Go(func() error { | ||||
| 						time.Sleep(10 * time.Millisecond) | ||||
| 						return pipe.Skip("fake skip") | ||||
| 					}) | ||||
| 				} | ||||
| 				merr := &multierror.Error{} | ||||
| 				require.ErrorAs(t, g.Wait(), &merr, "must be a multierror") | ||||
| 				require.Len(t, merr.Errors, 10) | ||||
| 			}) | ||||
| 		}) | ||||
| 	} | ||||
| } | ||||
| @@ -123,17 +136,20 @@ func TestSemaphoreSkipAware(t *testing.T) { | ||||
| func TestSemaphoreSkipAwareSingleError(t *testing.T) { | ||||
| 	for _, i := range []int{1, 4} { | ||||
| 		t.Run(fmt.Sprintf("limit-%d", i), func(t *testing.T) { | ||||
| 			g := NewSkipAware(New(i)) | ||||
| 			for i := range 10 { | ||||
| 				g.Go(func() error { | ||||
| 					time.Sleep(10 * time.Millisecond) | ||||
| 					if i == 5 { | ||||
| 						return pipe.Skip("fake skip") | ||||
| 					} | ||||
| 					return nil | ||||
| 				}) | ||||
| 			} | ||||
| 			require.EqualError(t, g.Wait(), "fake skip") | ||||
| 			synctest.Test(t, func(t *testing.T) { | ||||
| 				t.Helper() | ||||
| 				g := NewSkipAware(New(i)) | ||||
| 				for i := range 10 { | ||||
| 					g.Go(func() error { | ||||
| 						time.Sleep(10 * time.Millisecond) | ||||
| 						if i == 5 { | ||||
| 							return pipe.Skip("fake skip") | ||||
| 						} | ||||
| 						return nil | ||||
| 					}) | ||||
| 				} | ||||
| 				require.EqualError(t, g.Wait(), "fake skip") | ||||
| 			}) | ||||
| 		}) | ||||
| 	} | ||||
| } | ||||
| @@ -141,29 +157,35 @@ func TestSemaphoreSkipAwareSingleError(t *testing.T) { | ||||
| func TestSemaphoreSkipAwareNoSkips(t *testing.T) { | ||||
| 	for _, i := range []int{1, 4} { | ||||
| 		t.Run(fmt.Sprintf("limit-%d", i), func(t *testing.T) { | ||||
| 			g := NewSkipAware(New(i)) | ||||
| 			for range 10 { | ||||
| 				g.Go(func() error { | ||||
| 					time.Sleep(10 * time.Millisecond) | ||||
| 					return nil | ||||
| 				}) | ||||
| 			} | ||||
| 			require.NoError(t, g.Wait()) | ||||
| 			synctest.Test(t, func(t *testing.T) { | ||||
| 				t.Helper() | ||||
| 				g := NewSkipAware(New(i)) | ||||
| 				for range 10 { | ||||
| 					g.Go(func() error { | ||||
| 						time.Sleep(10 * time.Millisecond) | ||||
| 						return nil | ||||
| 					}) | ||||
| 				} | ||||
| 				require.NoError(t, g.Wait()) | ||||
| 			}) | ||||
| 		}) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func TestSemaphoreSkipAndRealError(t *testing.T) { | ||||
| 	g := NewSkipAware(New(10)) | ||||
| 	for range 100 { | ||||
| 	synctest.Test(t, func(t *testing.T) { | ||||
| 		t.Helper() | ||||
| 		g := NewSkipAware(New(10)) | ||||
| 		for range 100 { | ||||
| 			g.Go(func() error { | ||||
| 				time.Sleep(10 * time.Millisecond) | ||||
| 				return pipe.Skip("fake skip") | ||||
| 			}) | ||||
| 		} | ||||
| 		g.Go(func() error { | ||||
| 			time.Sleep(10 * time.Millisecond) | ||||
| 			return pipe.Skip("fake skip") | ||||
| 			return fmt.Errorf("errrrrr") | ||||
| 		}) | ||||
| 	} | ||||
| 	g.Go(func() error { | ||||
| 		time.Sleep(10 * time.Millisecond) | ||||
| 		return fmt.Errorf("errrrrr") | ||||
| 		require.EqualError(t, g.Wait(), "errrrrr") | ||||
| 	}) | ||||
| 	require.EqualError(t, g.Wait(), "errrrrr") | ||||
| } | ||||
|   | ||||
							
								
								
									
										9
									
								
								internal/testlib/go.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								internal/testlib/go.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| package testlib | ||||
|  | ||||
| import ( | ||||
| 	"runtime" | ||||
| 	"strings" | ||||
| ) | ||||
|  | ||||
| // GoVersion is the current Go version, without the "go" prefix. | ||||
| var GoVersion = strings.TrimPrefix(runtime.Version(), "go") | ||||
		Reference in New Issue
	
	Block a user