diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-23 22:38:20 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-23 22:38:20 +0200 |
| commit | c58b3f64de0cc6da880672b1ccb5671707ce47d3 (patch) | |
| tree | ceb5cdae647105894773a3469fb832be800b04f3 | |
| parent | 3d055d404dd3de55862860e21515d92f8fb2550d (diff) | |
.golangci.yml
| -rw-r--r-- | .golangci.yml | 25 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | go.mod | 4 | ||||
| -rw-r--r-- | go.sum | 7 | ||||
| -rw-r--r-- | internal/repl/repl.go | 9 |
5 files changed, 15 insertions, 32 deletions
diff --git a/.golangci.yml b/.golangci.yml deleted file mode 100644 index 2b76c52..0000000 --- a/.golangci.yml +++ /dev/null @@ -1,25 +0,0 @@ -# golangci-lint configuration for perc project - -linters: - enable: - - gofmt - - goimports - - govet - - errcheck - - staticcheck - - unused - - gosimple - - structcheck - - varcheck - - ineffassign - - deadcode - - typecheck - -linters-settings: - goimports: - local-prefixes: codeberg.org/snonux/perc - errcheck: - check-blank: false - -run: - timeout: 5m @@ -1,6 +1,6 @@ # perc -A simple vibe-coded command-line percentage calculator written in Go. +A simple AI-engineered command-line percentage calculator written in Go. ## Installation @@ -5,7 +5,7 @@ go 1.25.4 require ( github.com/c-bata/go-prompt v0.2.6 github.com/magefile/mage v1.15.0 - github.com/mattn/go-isatty v0.0.12 + github.com/mattn/go-isatty v0.0.20 ) require ( @@ -13,5 +13,5 @@ require ( github.com/mattn/go-runewidth v0.0.9 // indirect github.com/mattn/go-tty v0.0.3 // indirect github.com/pkg/term v1.2.0-beta.2 // indirect - golang.org/x/sys v0.0.0-20200918174421-af09f7315aff // indirect + golang.org/x/sys v0.42.0 // indirect ) @@ -7,8 +7,9 @@ github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3 github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= @@ -23,5 +24,7 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200918174421-af09f7315aff h1:1CPUrky56AcgSpxz/KfgzQWzfG09u5YOL8MvPYBlrL8= golang.org/x/sys v0.0.0-20200918174421-af09f7315aff/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= +golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= diff --git a/internal/repl/repl.go b/internal/repl/repl.go index 1870d6c..4e0bca6 100644 --- a/internal/repl/repl.go +++ b/internal/repl/repl.go @@ -192,13 +192,15 @@ func loadHistory() []string { if err != nil { return nil } - defer file.Close() var history []string scanner := bufio.NewScanner(file) for scanner.Scan() { history = append(history, scanner.Text()) } + if err := file.Close(); err != nil { + return nil + } return history } @@ -226,7 +228,10 @@ func saveHistory(history []string) error { return err } } - return writer.Flush() + if err := writer.Flush(); err != nil { + return err + } + return file.Close() } // completer provides auto-completion for built-in commands |
