mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
commit
0a91857ecd
@ -131,7 +131,12 @@ func getConfigFile(flags Flags) string {
|
||||
if flags.IsSet("config") {
|
||||
return config
|
||||
}
|
||||
for _, f := range []string{".goreleaser.yml", "goreleaser.yml"} {
|
||||
for _, f := range []string{
|
||||
".goreleaser.yml",
|
||||
".goreleaser.yaml",
|
||||
"goreleaser.yml",
|
||||
"goreleaser.yaml",
|
||||
} {
|
||||
_, ferr := os.Stat(f)
|
||||
if ferr == nil || os.IsExist(ferr) {
|
||||
return f
|
||||
|
@ -56,19 +56,28 @@ func TestConfigFileIsSetAndDontExist(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConfigFlagNotSetButExists(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
folder, back := setup(t)
|
||||
defer back()
|
||||
assert.NoError(
|
||||
os.Rename(
|
||||
filepath.Join(folder, "goreleaser.yml"),
|
||||
filepath.Join(folder, ".goreleaser.yml"),
|
||||
),
|
||||
)
|
||||
var flags = fakeFlags{
|
||||
flags: map[string]string{},
|
||||
for _, name := range []string{
|
||||
".goreleaser.yml",
|
||||
".goreleaser.yaml",
|
||||
"goreleaser.yml",
|
||||
"goreleaser.yaml",
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
folder, back := setup(t)
|
||||
defer back()
|
||||
assert.NoError(
|
||||
t,
|
||||
os.Rename(
|
||||
filepath.Join(folder, "goreleaser.yml"),
|
||||
filepath.Join(folder, name),
|
||||
),
|
||||
)
|
||||
var flags = fakeFlags{
|
||||
flags: map[string]string{},
|
||||
}
|
||||
assert.Equal(t, name, getConfigFile(flags))
|
||||
})
|
||||
}
|
||||
assert.Equal(".goreleaser.yml", getConfigFile(flags))
|
||||
}
|
||||
|
||||
func TestReleaseNotesFileDontExist(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user