mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-05 13:15:26 +02:00
test: do not prefix version with v
This commit is contained in:
parent
b5ea693ada
commit
f731173491
@ -236,8 +236,8 @@ func TestBuild(t *testing.T) {
|
||||
}
|
||||
ctx := context.New(config)
|
||||
ctx.Env["GO_FLAGS"] = "-v"
|
||||
ctx.Git.CurrentTag = "5.6.7"
|
||||
ctx.Version = "v" + ctx.Git.CurrentTag
|
||||
ctx.Git.CurrentTag = "v5.6.7"
|
||||
ctx.Version = ctx.Git.CurrentTag
|
||||
build := ctx.Config.Builds[0]
|
||||
for _, target := range build.Targets {
|
||||
var ext string
|
||||
@ -842,8 +842,8 @@ func TestBuildModTimestamp(t *testing.T) {
|
||||
}
|
||||
ctx := context.New(config)
|
||||
ctx.Env["GO_FLAGS"] = "-v"
|
||||
ctx.Git.CurrentTag = "5.6.7"
|
||||
ctx.Version = "v" + ctx.Git.CurrentTag
|
||||
ctx.Git.CurrentTag = "v5.6.7"
|
||||
ctx.Version = ctx.Git.CurrentTag
|
||||
build := ctx.Config.Builds[0]
|
||||
for _, target := range build.Targets {
|
||||
var ext string
|
||||
@ -885,7 +885,7 @@ func TestBuildGoBuildLine(t *testing.T) {
|
||||
Builds: []config.Build{build},
|
||||
}
|
||||
ctx := context.New(config)
|
||||
ctx.Version = "v1.2.3"
|
||||
ctx.Version = "1.2.3"
|
||||
ctx.Git.Commit = "aaa"
|
||||
|
||||
line, err := buildGoBuildLine(ctx, config.Builds[0], api.Options{Path: "foo"}, &artifact.Artifact{}, []string{})
|
||||
@ -927,7 +927,7 @@ func TestBuildGoBuildLine(t *testing.T) {
|
||||
GoBinary: "go",
|
||||
}, []string{
|
||||
"go", "build",
|
||||
"-ldflags=-s -w -X main.version=v1.2.3 -X main.commit=aaa -X main.builtBy=goreleaser",
|
||||
"-ldflags=-s -w -X main.version=1.2.3 -X main.commit=aaa -X main.builtBy=goreleaser",
|
||||
"-o", "foo", ".",
|
||||
})
|
||||
})
|
||||
@ -937,7 +937,7 @@ func TestBuildGoBuildLine(t *testing.T) {
|
||||
Main: ".",
|
||||
Ldflags: []string{"-s -w", "-X main.version={{.Version}}"},
|
||||
GoBinary: "go",
|
||||
}, []string{"go", "build", "-ldflags=-s -w -X main.version=v1.2.3", "-o", "foo", "."})
|
||||
}, []string{"go", "build", "-ldflags=-s -w -X main.version=1.2.3", "-o", "foo", "."})
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -478,7 +478,7 @@ func TestInvalidConfig(t *testing.T) {
|
||||
},
|
||||
})
|
||||
ctx.Git.CurrentTag = "v1.2.3"
|
||||
ctx.Version = "v1.2.3"
|
||||
ctx.Version = "1.2.3"
|
||||
ctx.Artifacts.Add(&artifact.Artifact{
|
||||
Name: "mybin",
|
||||
Path: filepath.Join(dist, "mybin", "mybin"),
|
||||
|
@ -79,7 +79,7 @@ func TestRunPipe(t *testing.T) {
|
||||
},
|
||||
})
|
||||
ctx.Git.CurrentTag = "v1.2.3"
|
||||
ctx.Version = "v1.2.3"
|
||||
ctx.Version = "1.2.3"
|
||||
addBinaries(t, ctx, "foo", filepath.Join(dist, "foo"))
|
||||
addBinaries(t, ctx, "bar", filepath.Join(dist, "bar"))
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
@ -106,7 +106,7 @@ func TestRunPipeInvalidNameTemplate(t *testing.T) {
|
||||
},
|
||||
})
|
||||
ctx.Git.CurrentTag = "v1.2.3"
|
||||
ctx.Version = "v1.2.3"
|
||||
ctx.Version = "1.2.3"
|
||||
addBinaries(t, ctx, "foo", dist)
|
||||
require.EqualError(t, Pipe{}.Run(ctx), `template: tmpl:1: unexpected "}" in operand`)
|
||||
}
|
||||
@ -133,7 +133,7 @@ func TestRunPipeWithName(t *testing.T) {
|
||||
},
|
||||
})
|
||||
ctx.Git.CurrentTag = "v1.2.3"
|
||||
ctx.Version = "v1.2.3"
|
||||
ctx.Version = "1.2.3"
|
||||
addBinaries(t, ctx, "foo", dist)
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
yamlFile, err := os.ReadFile(filepath.Join(dist, "foo_amd64", "prime", "meta", "snap.yaml"))
|
||||
@ -183,7 +183,7 @@ func TestRunPipeMetadata(t *testing.T) {
|
||||
},
|
||||
})
|
||||
ctx.Git.CurrentTag = "v1.2.3"
|
||||
ctx.Version = "v1.2.3"
|
||||
ctx.Version = "1.2.3"
|
||||
addBinaries(t, ctx, "foo", dist)
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
yamlFile, err := os.ReadFile(filepath.Join(dist, "foo_amd64", "prime", "meta", "snap.yaml"))
|
||||
@ -244,7 +244,7 @@ func TestRunNoArguments(t *testing.T) {
|
||||
},
|
||||
})
|
||||
ctx.Git.CurrentTag = "v1.2.3"
|
||||
ctx.Version = "v1.2.3"
|
||||
ctx.Version = "1.2.3"
|
||||
addBinaries(t, ctx, "foo", dist)
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
yamlFile, err := os.ReadFile(filepath.Join(dist, "foo_amd64", "prime", "meta", "snap.yaml"))
|
||||
@ -281,7 +281,7 @@ func TestCompleter(t *testing.T) {
|
||||
},
|
||||
})
|
||||
ctx.Git.CurrentTag = "v1.2.3"
|
||||
ctx.Version = "v1.2.3"
|
||||
ctx.Version = "1.2.3"
|
||||
addBinaries(t, ctx, "foo", dist)
|
||||
addBinaries(t, ctx, "bar", dist)
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
@ -320,7 +320,7 @@ func TestCommand(t *testing.T) {
|
||||
},
|
||||
})
|
||||
ctx.Git.CurrentTag = "v1.2.3"
|
||||
ctx.Version = "v1.2.3"
|
||||
ctx.Version = "1.2.3"
|
||||
addBinaries(t, ctx, "foo", dist)
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
yamlFile, err := os.ReadFile(filepath.Join(dist, "foo_amd64", "prime", "meta", "snap.yaml"))
|
||||
@ -360,7 +360,7 @@ func TestExtraFile(t *testing.T) {
|
||||
},
|
||||
})
|
||||
ctx.Git.CurrentTag = "v1.2.3"
|
||||
ctx.Version = "v1.2.3"
|
||||
ctx.Version = "1.2.3"
|
||||
addBinaries(t, ctx, "foo", dist)
|
||||
require.NoError(t, Pipe{}.Run(ctx))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user