Skip to content

Commit df5e6a4

Browse files
style: gofumpt
1 parent 8ead681 commit df5e6a4

File tree

8 files changed

+22
-19
lines changed

8 files changed

+22
-19
lines changed

cmd/semantic-release/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,12 @@ func cliHandler(cmd *cobra.Command, args []string) {
261261
}
262262
}
263263
changelogData := append([]byte(changelogRes), oldFile...)
264-
exitIfError(ioutil.WriteFile(conf.Changelog, changelogData, 0644))
264+
exitIfError(ioutil.WriteFile(conf.Changelog, changelogData, 0o644))
265265
}
266266

267267
if conf.Dry {
268268
if conf.VersionFile {
269-
exitIfError(ioutil.WriteFile(".version-unreleased", []byte(newVer), 0644))
269+
exitIfError(ioutil.WriteFile(".version-unreleased", []byte(newVer), 0o644))
270270
}
271271
exitIfError(errors.New("DRY RUN: no release was created"), 0)
272272
}
@@ -282,11 +282,11 @@ func cliHandler(cmd *cobra.Command, args []string) {
282282
exitIfError(prov.CreateRelease(newRelease))
283283

284284
if conf.Ghr {
285-
exitIfError(ioutil.WriteFile(".ghr", []byte(fmt.Sprintf("-u %s -r %s v%s", repoInfo.Owner, repoInfo.Repo, newVer)), 0644))
285+
exitIfError(ioutil.WriteFile(".ghr", []byte(fmt.Sprintf("-u %s -r %s v%s", repoInfo.Owner, repoInfo.Repo, newVer)), 0o644))
286286
}
287287

288288
if conf.VersionFile {
289-
exitIfError(ioutil.WriteFile(".version", []byte(newVer), 0644))
289+
exitIfError(ioutil.WriteFile(".version", []byte(newVer), 0o644))
290290
}
291291

292292
if len(conf.UpdateFiles) == 0 && len(conf.FilesUpdaterPlugins) > 0 {

pkg/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ func NewConfig(cmd *cobra.Command) (*Config, error) {
135135
}
136136
return conf, nil
137137
}
138+
138139
func must(err error) {
139140
if err != nil {
140141
panic(err)

pkg/plugin/client.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ import (
1414
"github.com/hashicorp/go-plugin"
1515
)
1616

17-
var runningClientsMx sync.Mutex
18-
var runningClients = make([]*plugin.Client, 0)
17+
var (
18+
runningClientsMx sync.Mutex
19+
runningClients = make([]*plugin.Client, 0)
20+
)
1921

2022
func KillAllPlugins() {
2123
runningClientsMx.Lock()

pkg/plugin/discovery/download.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func extractFileFromTarGz(name, inputFile, outputFile string) error {
7373
return err
7474
}
7575
if header.Typeflag == tar.TypeReg && strings.HasPrefix(header.Name, name) {
76-
outFile, err := os.OpenFile(outputFile, os.O_CREATE|os.O_WRONLY, 0755)
76+
outFile, err := os.OpenFile(outputFile, os.O_CREATE|os.O_WRONLY, 0o755)
7777
if err != nil {
7878
return err
7979
}
@@ -120,7 +120,7 @@ func downloadPlugin(pluginInfo *plugin.PluginInfo, downloadInfo *resolver.Plugin
120120
}
121121
targetFile = outFile
122122
}
123-
if err := os.Chmod(targetFile, 0755); err != nil {
123+
if err := os.Chmod(targetFile, 0o755); err != nil {
124124
return "", err
125125
}
126126
return targetFile, nil

pkg/plugin/discovery/local.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var osArchDir = runtime.GOOS + "_" + runtime.GOARCH
2020
func setAndEnsurePluginPath(pluginInfo *plugin.PluginInfo) error {
2121
pluginPath := path.Join(PluginDir, osArchDir, pluginInfo.NormalizedName)
2222
if _, err := os.Stat(pluginPath); os.IsNotExist(err) {
23-
if err := os.MkdirAll(pluginPath, 0755); err != nil {
23+
if err := os.MkdirAll(pluginPath, 0o755); err != nil {
2424
return err
2525
}
2626
} else if err != nil {
@@ -86,7 +86,7 @@ func findPluginLocally(pluginInfo *plugin.PluginInfo) (string, error) {
8686
if f.IsDir() {
8787
continue
8888
}
89-
if f.Mode()&0100 == 0 {
89+
if f.Mode()&0o100 == 0 {
9090
continue
9191
}
9292
return path.Join(vPth, f.Name()), nil

pkg/plugin/discovery/resolver/registry/registry.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import (
1111
"github.com/go-semantic-release/semantic-release/v2/pkg/plugin/discovery/resolver"
1212
)
1313

14-
type RegistryResolver struct {
15-
}
14+
type RegistryResolver struct{}
1615

1716
func NewResolver() *RegistryResolver {
1817
return &RegistryResolver{}

pkg/plugin/serve.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ var Handshake = plugin.HandshakeConfig{
1515
MagicCookieValue: "beepboop",
1616
}
1717

18-
type CommitAnalyzerFunc func() analyzer.CommitAnalyzer
19-
type CIConditionFunc func() condition.CICondition
20-
type ChangelogGeneratorFunc func() generator.ChangelogGenerator
21-
type ProviderFunc func() provider.Provider
22-
type FilesUpdaterFunc func() updater.FilesUpdater
23-
type HooksFunc func() hooks.Hooks
18+
type (
19+
CommitAnalyzerFunc func() analyzer.CommitAnalyzer
20+
CIConditionFunc func() condition.CICondition
21+
ChangelogGeneratorFunc func() generator.ChangelogGenerator
22+
ProviderFunc func() provider.Provider
23+
FilesUpdaterFunc func() updater.FilesUpdater
24+
HooksFunc func() hooks.Hooks
25+
)
2426

2527
type ServeOpts struct {
2628
CommitAnalyzer CommitAnalyzerFunc

pkg/semrel/semrel_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ func TestApplyChange(t *testing.T) {
7373
for _, tc := range testCases {
7474
t.Run(fmt.Sprintf("Version: %s, Change: %v, Expected: %s", tc.currentVersion, tc.change, tc.expectedVersion), func(t *testing.T) {
7575
current, err := semver.NewVersion(tc.currentVersion)
76-
7776
if err != nil {
7877
t.Errorf("failed to create version: %v", err)
7978
}

0 commit comments

Comments
 (0)