chore: remove pinned golangci-lint

This commit is contained in:
Jan De Dobbeleer 2023-06-14 07:27:59 +02:00 committed by Jan De Dobbeleer
parent 4c0c596c2c
commit c0429406dc
9 changed files with 28 additions and 33 deletions

View file

@ -28,9 +28,6 @@ jobs:
- name: Golang CI
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299
with:
# version: latest
# Pinning the version until https://github.com/golangci/golangci-lint/issues/3862 is solved
version: v1.52.2
working-directory: src
- name: Unit Tests
run: go test -v ./...

View file

@ -5,7 +5,6 @@ linters:
disable-all: true
enable:
- bodyclose
- depguard
- dupl
- errcheck
- exhaustive

View file

@ -425,8 +425,8 @@ func (w *Writer) writeSegmentColors() {
w.currentForeground = fg
}
func (w *Writer) writeColorOverrides(match map[string]string, background string, i int) (position int) {
position = i
func (w *Writer) writeColorOverrides(match map[string]string, background string, i int) int {
position := i
// check color reset first
if match[ANCHOR] == resetStyle.AnchorEnd {
// make sure to reset the colors if needed
@ -434,12 +434,12 @@ func (w *Writer) writeColorOverrides(match map[string]string, background string,
// do not reset when colors are identical
if w.currentBackground == w.background && w.currentForeground == w.foreground {
return
return position
}
// do not restore colors at the end of the string, we print it anyways
if position == len(w.runes)-1 {
return
return position
}
if w.transparent {
@ -459,7 +459,7 @@ func (w *Writer) writeColorOverrides(match map[string]string, background string,
}
w.transparent = false
return
return position
}
position += len([]rune(match[ANCHOR])) - 1
@ -467,11 +467,11 @@ func (w *Writer) writeColorOverrides(match map[string]string, background string,
for _, style := range knownStyles {
if style.AnchorEnd == match[ANCHOR] {
w.writeEscapedAnsiString(style.End)
return
return position
}
if style.AnchorStart == match[ANCHOR] {
w.writeEscapedAnsiString(style.Start)
return
return position
}
}
@ -483,7 +483,7 @@ func (w *Writer) writeColorOverrides(match map[string]string, background string,
// ignore processing fully tranparent colors
w.invisible = w.currentForeground.IsTransparent() && w.currentBackground.IsTransparent()
if w.invisible {
return
return position
}
// make sure we have colors
@ -498,13 +498,13 @@ func (w *Writer) writeColorOverrides(match map[string]string, background string,
background := w.getAnsiFromColorString(w.TerminalBackground, false)
w.writeEscapedAnsiString(fmt.Sprintf(colorise, background))
w.writeEscapedAnsiString(fmt.Sprintf(colorise, w.currentBackground.ToForeground()))
return
return position
}
if w.currentForeground.IsTransparent() && !w.currentBackground.IsTransparent() {
w.transparent = true
w.writeEscapedAnsiString(fmt.Sprintf(transparent, w.currentBackground))
return
return position
}
if w.currentBackground != w.background {

View file

@ -10,12 +10,12 @@ import (
"strings"
)
func InstallZIP(data []byte, user bool) (err error) {
func InstallZIP(data []byte, user bool) error {
bytesReader := bytes.NewReader(data)
zipReader, err := zip.NewReader(bytesReader, int64(bytesReader.Len()))
if err != nil {
return
return err
}
fonts := make(map[string]*Font)

View file

@ -9,17 +9,15 @@ import (
var FontsDir = path.Join(os.Getenv("HOME"), "Library", "Fonts")
func install(font *Font, _ bool) (err error) {
func install(font *Font, _ bool) error {
// On darwin/OSX, the user's fonts directory is ~/Library/Fonts,
// and fonts should be installed directly into that path;
// i.e., not in subfolders.
fullPath := path.Join(FontsDir, path.Base(font.FileName))
if err = os.MkdirAll(path.Dir(fullPath), 0700); err != nil {
return
if err := os.MkdirAll(path.Dir(fullPath), 0700); err != nil {
return err
}
err = os.WriteFile(fullPath, font.Data, 0644)
return
return os.WriteFile(fullPath, font.Data, 0644)
}

View file

@ -14,7 +14,7 @@ import (
// FontsDir denotes the path to the user's fonts directory on Unix-like systems.
var FontsDir = path.Join(os.Getenv("HOME"), "/.local/share/fonts")
func install(font *Font, _ bool) (err error) {
func install(font *Font, _ bool) error {
// On Linux, fontconfig can understand subdirectories. So, to keep the
// font directory clean, install all font files for a particular font
// family into a subdirectory named after the family (with hyphens instead
@ -23,7 +23,7 @@ func install(font *Font, _ bool) (err error) {
strings.ToLower(strings.ReplaceAll(font.Family, " ", "-")),
path.Base(font.FileName))
if err = os.MkdirAll(path.Dir(fullPath), 0700); err != nil {
if err := os.MkdirAll(path.Dir(fullPath), 0700); err != nil {
return err
}

View file

@ -18,7 +18,7 @@ const (
HWND_BROADCAST = 0xFFFF //nolint:revive
)
func install(font *Font, admin bool) (err error) {
func install(font *Font, admin bool) error {
// To install a font on Windows:
// - Copy the file to the fonts directory
// - Add registry entry
@ -36,7 +36,7 @@ func install(font *Font, admin bool) (err error) {
return fmt.Errorf("Unable to remove existing font file: %s", err.Error())
}
}
err = os.WriteFile(fullPath, font.Data, 0644)
err := os.WriteFile(fullPath, font.Data, 0644)
if err != nil {
return fmt.Errorf("Unable to write font file: %s", err.Error())
}
@ -73,7 +73,7 @@ func install(font *Font, admin bool) (err error) {
fontPtr, err := syscall.UTF16PtrFromString(fullPath)
if err != nil {
return
return err
}
ret, _, _ := proc.Call(uintptr(unsafe.Pointer(fontPtr)))

View file

@ -524,9 +524,10 @@ func (pt *Path) normalizePath(path string) string {
}
// ParsePath parses an input path and returns a clean root and a clean path.
func (pt *Path) parsePath(inputPath string) (root, path string) {
func (pt *Path) parsePath(inputPath string) (string, string) {
var root, path string
if len(inputPath) == 0 {
return
return root, path
}
separator := pt.env.PathSeparator()
clean := func(path string) string {
@ -549,7 +550,7 @@ func (pt *Path) parsePath(inputPath string) (root, path string) {
if len(matches) > 0 {
root = `\\` + matches["hostname"] + `\` + matches["sharename"]
path = clean(matches["path"])
return
return root, path
}
}
s := strings.SplitAfterN(inputPath, separator, 2)

View file

@ -39,16 +39,16 @@ func (u *Unity) Enabled() bool {
return true
}
func (u *Unity) GetUnityVersion() (version string, err error) {
func (u *Unity) GetUnityVersion() (string, error) {
projectDir, err := u.env.HasParentFilePath("ProjectSettings")
if err != nil {
u.env.Debug("No ProjectSettings parent folder found")
return
return "", err
}
if !u.env.HasFilesInDir(projectDir.Path, "ProjectVersion.txt") {
u.env.Debug("No ProjectVersion.txt file found")
return
return "", err
}
versionFilePath := filepath.Join(projectDir.Path, "ProjectVersion.txt")