diff --git a/src/ansi/colors_unix.go b/src/ansi/colors_unix.go index 7adcef4c..f6885d68 100644 --- a/src/ansi/colors_unix.go +++ b/src/ansi/colors_unix.go @@ -4,11 +4,11 @@ package ansi import "github.com/jandedobbeleer/oh-my-posh/src/platform" -func GetAccentColor(env platform.Environment) (*RGB, error) { +func GetAccentColor(_ platform.Environment) (*RGB, error) { return nil, &platform.NotImplemented{} } -func (d *DefaultColors) SetAccentColor(env platform.Environment, defaultColor string) { +func (d *DefaultColors) SetAccentColor(_ platform.Environment, defaultColor string) { if len(defaultColor) == 0 { return } diff --git a/src/cli/init.go b/src/cli/init.go index b2da8f94..91568a5b 100644 --- a/src/cli/init.go +++ b/src/cli/init.go @@ -11,9 +11,9 @@ import ( ) var ( - print bool - strict bool - manual bool + printOutput bool + strict bool + manual bool initCmd = &cobra.Command{ Use: "init [bash|zsh|fish|powershell|pwsh|cmd|nu] --config ~/.mytheme.omp.json", @@ -45,7 +45,7 @@ See the documentation to initialize your shell: https://ohmyposh.dev/docs/instal ) func init() { //nolint:gochecknoinits - initCmd.Flags().BoolVarP(&print, "print", "p", false, "print the init script") + initCmd.Flags().BoolVarP(&printOutput, "print", "p", false, "print the init script") initCmd.Flags().BoolVarP(&strict, "strict", "s", false, "run in strict mode") initCmd.Flags().BoolVarP(&manual, "manual", "m", false, "enable/disable manual mode") _ = initCmd.MarkPersistentFlagRequired("config") @@ -77,7 +77,7 @@ func runInit(shellName string) { shell.RPrompt = true } } - if print { + if printOutput { init := shell.PrintInit(env) fmt.Print(init) return diff --git a/src/engine/migrate_test.go b/src/engine/migrate_test.go index 06f426ef..428ee8a4 100644 --- a/src/engine/migrate_test.go +++ b/src/engine/migrate_test.go @@ -89,7 +89,7 @@ func (m *MockedWriter) Template() string { return m.template } -func (m *MockedWriter) Init(props properties.Properties, env platform.Environment) {} +func (m *MockedWriter) Init(_ properties.Properties, _ platform.Environment) {} func TestIconOverride(t *testing.T) { cases := []struct { diff --git a/src/font/cli.go b/src/font/cli.go index 68c1ddc1..22102d46 100644 --- a/src/font/cli.go +++ b/src/font/cli.go @@ -37,9 +37,9 @@ type state int type itemDelegate struct{} -func (d itemDelegate) Height() int { return 1 } -func (d itemDelegate) Spacing() int { return 0 } -func (d itemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd { return nil } +func (d itemDelegate) Height() int { return 1 } +func (d itemDelegate) Spacing() int { return 0 } +func (d itemDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd { return nil } func (d itemDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item) { //nolint: gocritic i, ok := listItem.(*Asset) if !ok { diff --git a/src/font/font.go b/src/font/font.go index 1433b7d4..2f33caf4 100644 --- a/src/font/font.go +++ b/src/font/font.go @@ -27,10 +27,10 @@ var fontExtensions = map[string]bool{ ".ttf": true, } -// new creates a new Font struct. +// newFont creates a newFont Font struct. // fileName is the font's file name, and data is a byte slice containing the font file data. // It returns a FontData struct describing the font, or an error. -func new(fileName string, data []byte) (*Font, error) { +func newFont(fileName string, data []byte) (*Font, error) { if _, ok := fontExtensions[strings.ToLower(path.Ext(fileName))]; !ok { return nil, fmt.Errorf("not a font: %v", fileName) } diff --git a/src/font/install.go b/src/font/install.go index f6f14e3e..9d85a7c0 100644 --- a/src/font/install.go +++ b/src/font/install.go @@ -33,7 +33,7 @@ func InstallZIP(data []byte) (err error) { return err } - fontData, err := new(zf.Name, data) + fontData, err := newFont(zf.Name, data) if err != nil { continue } diff --git a/src/go.mod b/src/go.mod index f7a023da..21cbb200 100644 --- a/src/go.mod +++ b/src/go.mod @@ -96,4 +96,4 @@ replace github.com/atotto/clipboard v0.1.4 => github.com/jandedobbeleer/clipboar replace github.com/shirou/gopsutil/v3 v3.22.10 => github.com/jandedobbeleer/gopsutil/v3 v3.22.10-1 -replace github.com/goccy/go-yaml v1.10.0 => github.com/jandedobbeleer/go-yaml v1.10.0-3 +replace github.com/goccy/go-yaml v1.10.0 => github.com/jandedobbeleer/go-yaml v1.10.0-4 diff --git a/src/go.sum b/src/go.sum index ead15b56..e1ad9ace 100644 --- a/src/go.sum +++ b/src/go.sum @@ -92,8 +92,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jandedobbeleer/clipboard v0.1.4-1 h1:rJehm5W0a3hvjcxyB3snqLBV4yvMBBc12JyMP7ngNQw= github.com/jandedobbeleer/clipboard v0.1.4-1/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/jandedobbeleer/go-yaml v1.10.0-3 h1:uJNH470S70mcQTWPPf3oa9/A2XjLqQI4b2e+fkbgoc4= -github.com/jandedobbeleer/go-yaml v1.10.0-3/go.mod h1:h/18Lr6oSQ3mvmqFoWmQ47KChOgpfHpTyIHl3yVmpiY= +github.com/jandedobbeleer/go-yaml v1.10.0-4 h1:syHCr1xD43Odtfd8eJrPVr6YU38+EvE9B6+nry9/o1U= +github.com/jandedobbeleer/go-yaml v1.10.0-4/go.mod h1:BpNLgczNY7xmm+5yoSBm62mqE8SB9eCKcemdBA3Iod4= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -239,7 +239,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/src/mock/environment.go b/src/mock/environment.go index f98f57ab..0ac0f348 100644 --- a/src/mock/environment.go +++ b/src/mock/environment.go @@ -145,7 +145,7 @@ func (env *MockedEnvironment) WindowsRegistryKeyValue(path string) (*platform.Wi return args.Get(0).(*platform.WindowsRegistryValue), args.Error(1) } -func (env *MockedEnvironment) HTTPRequest(url string, body io.Reader, timeout int, requestModifiers ...platform.HTTPRequestModifier) ([]byte, error) { +func (env *MockedEnvironment) HTTPRequest(url string, _ io.Reader, _ int, _ ...platform.HTTPRequestModifier) ([]byte, error) { args := env.Called(url) return args.Get(0).([]byte), args.Error(1) } @@ -199,12 +199,12 @@ func (env *MockedEnvironment) InWSLSharedDrive() bool { return args.Bool(0) } -func (env *MockedEnvironment) ConvertToWindowsPath(path string) string { +func (env *MockedEnvironment) ConvertToWindowsPath(_ string) string { args := env.Called() return args.String(0) } -func (env *MockedEnvironment) ConvertToLinuxPath(path string) string { +func (env *MockedEnvironment) ConvertToLinuxPath(_ string) string { args := env.Called() return args.String(0) } diff --git a/src/platform/shell_unix.go b/src/platform/shell_unix.go index 74aa64f5..4947a3d1 100644 --- a/src/platform/shell_unix.go +++ b/src/platform/shell_unix.go @@ -23,7 +23,7 @@ func (env *Shell) Home() string { return os.Getenv("HOME") } -func (env *Shell) QueryWindowTitles(processName, windowTitleRegex string) (string, error) { +func (env *Shell) QueryWindowTitles(_, _ string) (string, error) { return "", &NotImplemented{} } @@ -97,7 +97,7 @@ func (env *Shell) CachePath() string { return env.Home() } -func (env *Shell) WindowsRegistryKeyValue(path string) (*WindowsRegistryValue, error) { +func (env *Shell) WindowsRegistryKeyValue(_ string) (*WindowsRegistryValue, error) { return nil, &NotImplemented{} } @@ -124,7 +124,7 @@ func (env *Shell) ConvertToLinuxPath(path string) string { return path } -func (env *Shell) LookWinAppPath(file string) (string, error) { +func (env *Shell) LookWinAppPath(_ string) (string, error) { return "", errors.New("not relevant") } @@ -133,7 +133,7 @@ func (env *Shell) DirIsWritable(path string) bool { return unix.Access(path, unix.W_OK) == nil } -func (env *Shell) Connection(connectionType ConnectionType) (*Connection, error) { +func (env *Shell) Connection(_ ConnectionType) (*Connection, error) { // added to disable the linting error, we can implement this later if len(env.networks) == 0 { return nil, &NotImplemented{} diff --git a/src/segments/project.go b/src/segments/project.go index db1d6d00..6254af33 100644 --- a/src/segments/project.go +++ b/src/segments/project.go @@ -175,7 +175,7 @@ func (n *Project) getPoetryPackage(item ProjectItem) *ProjectData { } } -func (n *Project) getNuSpecPackage(item ProjectItem) *ProjectData { +func (n *Project) getNuSpecPackage(_ ProjectItem) *ProjectData { files := n.env.LsDir(n.env.Pwd()) var content string // get the first match only @@ -199,7 +199,7 @@ func (n *Project) getNuSpecPackage(item ProjectItem) *ProjectData { } } -func (n *Project) getDotnetProject(item ProjectItem) *ProjectData { +func (n *Project) getDotnetProject(_ ProjectItem) *ProjectData { files := n.env.LsDir(n.env.Pwd()) var name string var content string diff --git a/src/template/text_test.go b/src/template/text_test.go index 71d495ed..39940be6 100644 --- a/src/template/text_test.go +++ b/src/template/text_test.go @@ -170,9 +170,8 @@ func TestRenderTemplate(t *testing.T) { if tc.ShouldError { assert.Error(t, err) continue - } else { - assert.NoError(t, err) } + assert.NoError(t, err) assert.Equal(t, tc.Expected, text, tc.Case) } }