Skip to content
Snippets Groups Projects
Commit df5e6a40 authored by Christoph Witzko's avatar Christoph Witzko
Browse files

style: gofumpt

parent 8ead681a
No related branches found
No related tags found
No related merge requests found
......@@ -261,12 +261,12 @@ func cliHandler(cmd *cobra.Command, args []string) {
}
}
changelogData := append([]byte(changelogRes), oldFile...)
exitIfError(ioutil.WriteFile(conf.Changelog, changelogData, 0644))
exitIfError(ioutil.WriteFile(conf.Changelog, changelogData, 0o644))
}
if conf.Dry {
if conf.VersionFile {
exitIfError(ioutil.WriteFile(".version-unreleased", []byte(newVer), 0644))
exitIfError(ioutil.WriteFile(".version-unreleased", []byte(newVer), 0o644))
}
exitIfError(errors.New("DRY RUN: no release was created"), 0)
}
......@@ -282,11 +282,11 @@ func cliHandler(cmd *cobra.Command, args []string) {
exitIfError(prov.CreateRelease(newRelease))
if conf.Ghr {
exitIfError(ioutil.WriteFile(".ghr", []byte(fmt.Sprintf("-u %s -r %s v%s", repoInfo.Owner, repoInfo.Repo, newVer)), 0644))
exitIfError(ioutil.WriteFile(".ghr", []byte(fmt.Sprintf("-u %s -r %s v%s", repoInfo.Owner, repoInfo.Repo, newVer)), 0o644))
}
if conf.VersionFile {
exitIfError(ioutil.WriteFile(".version", []byte(newVer), 0644))
exitIfError(ioutil.WriteFile(".version", []byte(newVer), 0o644))
}
if len(conf.UpdateFiles) == 0 && len(conf.FilesUpdaterPlugins) > 0 {
......
......@@ -135,6 +135,7 @@ func NewConfig(cmd *cobra.Command) (*Config, error) {
}
return conf, nil
}
func must(err error) {
if err != nil {
panic(err)
......
......@@ -14,8 +14,10 @@ import (
"github.com/hashicorp/go-plugin"
)
var runningClientsMx sync.Mutex
var runningClients = make([]*plugin.Client, 0)
var (
runningClientsMx sync.Mutex
runningClients = make([]*plugin.Client, 0)
)
func KillAllPlugins() {
runningClientsMx.Lock()
......
......@@ -73,7 +73,7 @@ func extractFileFromTarGz(name, inputFile, outputFile string) error {
return err
}
if header.Typeflag == tar.TypeReg && strings.HasPrefix(header.Name, name) {
outFile, err := os.OpenFile(outputFile, os.O_CREATE|os.O_WRONLY, 0755)
outFile, err := os.OpenFile(outputFile, os.O_CREATE|os.O_WRONLY, 0o755)
if err != nil {
return err
}
......@@ -120,7 +120,7 @@ func downloadPlugin(pluginInfo *plugin.PluginInfo, downloadInfo *resolver.Plugin
}
targetFile = outFile
}
if err := os.Chmod(targetFile, 0755); err != nil {
if err := os.Chmod(targetFile, 0o755); err != nil {
return "", err
}
return targetFile, nil
......
......@@ -20,7 +20,7 @@ var osArchDir = runtime.GOOS + "_" + runtime.GOARCH
func setAndEnsurePluginPath(pluginInfo *plugin.PluginInfo) error {
pluginPath := path.Join(PluginDir, osArchDir, pluginInfo.NormalizedName)
if _, err := os.Stat(pluginPath); os.IsNotExist(err) {
if err := os.MkdirAll(pluginPath, 0755); err != nil {
if err := os.MkdirAll(pluginPath, 0o755); err != nil {
return err
}
} else if err != nil {
......@@ -86,7 +86,7 @@ func findPluginLocally(pluginInfo *plugin.PluginInfo) (string, error) {
if f.IsDir() {
continue
}
if f.Mode()&0100 == 0 {
if f.Mode()&0o100 == 0 {
continue
}
return path.Join(vPth, f.Name()), nil
......
......@@ -11,8 +11,7 @@ import (
"github.com/go-semantic-release/semantic-release/v2/pkg/plugin/discovery/resolver"
)
type RegistryResolver struct {
}
type RegistryResolver struct{}
func NewResolver() *RegistryResolver {
return &RegistryResolver{}
......
......@@ -15,12 +15,14 @@ var Handshake = plugin.HandshakeConfig{
MagicCookieValue: "beepboop",
}
type CommitAnalyzerFunc func() analyzer.CommitAnalyzer
type CIConditionFunc func() condition.CICondition
type ChangelogGeneratorFunc func() generator.ChangelogGenerator
type ProviderFunc func() provider.Provider
type FilesUpdaterFunc func() updater.FilesUpdater
type HooksFunc func() hooks.Hooks
type (
CommitAnalyzerFunc func() analyzer.CommitAnalyzer
CIConditionFunc func() condition.CICondition
ChangelogGeneratorFunc func() generator.ChangelogGenerator
ProviderFunc func() provider.Provider
FilesUpdaterFunc func() updater.FilesUpdater
HooksFunc func() hooks.Hooks
)
type ServeOpts struct {
CommitAnalyzer CommitAnalyzerFunc
......
......@@ -73,7 +73,6 @@ func TestApplyChange(t *testing.T) {
for _, tc := range testCases {
t.Run(fmt.Sprintf("Version: %s, Change: %v, Expected: %s", tc.currentVersion, tc.change, tc.expectedVersion), func(t *testing.T) {
current, err := semver.NewVersion(tc.currentVersion)
if err != nil {
t.Errorf("failed to create version: %v", err)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment