Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return errors where appropriate #21

Closed
wants to merge 27 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
191c113
Have the calls that can fail return the error interface, instead just…
perbu Nov 15, 2023
50fc556
all existing tests are now green. Should add a few more tests to chec…
perbu Nov 15, 2023
bfdb0b1
return the proper errors in the convenience functions.
perbu Nov 15, 2023
58190ed
test for the correct error types to be returned in the various tests.
perbu Nov 15, 2023
4dbb683
silly IDE did silly thing.
perbu Nov 15, 2023
f111f8b
silly IDE did silly thing. errstr showed up all over the place.
perbu Nov 15, 2023
fbca7a6
missed two errstr. grr.
perbu Nov 17, 2023
9253935
update dependencies
dmke Nov 17, 2023
148f953
bump module major version
dmke Nov 17, 2023
5e563b9
ci: update test/lint pipeline
dmke Nov 17, 2023
c18eabb
ci/yaml: quote version numbers
dmke Nov 17, 2023
3fd834b
remove deprecated calls.
perbu Nov 19, 2023
2ba865d
add some context to the getUnnamed call error.
perbu Nov 19, 2023
b180c24
remove deprecated calls.
perbu Nov 19, 2023
35346de
fix a todo, compare config output with prerendered configs.
perbu Nov 19, 2023
8086d93
Have the calls that can fail return the error interface, instead just…
perbu Nov 15, 2023
33cd1b8
all existing tests are now green. Should add a few more tests to chec…
perbu Nov 15, 2023
05a1f70
return the proper errors in the convenience functions.
perbu Nov 15, 2023
d166a6a
test for the correct error types to be returned in the various tests.
perbu Nov 15, 2023
c06ea89
silly IDE did silly thing.
perbu Nov 15, 2023
059f989
silly IDE did silly thing. errstr showed up all over the place.
perbu Nov 15, 2023
77cf9dd
missed two errstr. grr.
perbu Nov 17, 2023
80c6eb0
remove deprecated calls.
perbu Nov 19, 2023
75a4c33
add some context to the getUnnamed call error.
perbu Nov 19, 2023
af7ec8e
remove deprecated calls.
perbu Nov 19, 2023
fa46ebd
fix a todo, compare config output with prerendered configs.
perbu Nov 19, 2023
570bdc9
Merge branch 'master' of github.com:perbu/go-uci
perbu Nov 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ci: update test/lint pipeline
Also correct some linter issues.
dmke committed Nov 17, 2023
commit 5e563b93a6057351e45b3489efc61d804d0842c3
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest

env:
GO_VERSION: 1.16
GO_VERSION: 1.21

steps:
- name: Set up Go ${{ env.GO_VERSION }}
@@ -40,4 +40,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.37
version: v1.52
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
go-version: [1.13, 1.14, 1.15, 1.16, 1.x]
go-version: [1.20, 1.21, 1.x]

steps:
- name: Set up Go ${{ matrix.go-version }}
7 changes: 3 additions & 4 deletions uci.go
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@ package uci
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"sync"
@@ -118,7 +117,7 @@ func (t *tree) LoadConfig(name string, forceReload bool) error {
// loadConfig actually reads a config file. Its call must be guarded by
// locking the tree's mutex.
func (t *tree) loadConfig(name string) error {
body, err := ioutil.ReadFile(filepath.Join(t.dir, name))
body, err := os.ReadFile(filepath.Join(t.dir, name))
if err != nil {
return fmt.Errorf("reading config file failed: %w", err)
}
@@ -359,7 +358,7 @@ func (t *tree) saveConfig(c *config) error {
return err
}

if err = f.Chmod(0644); err != nil {
if err = f.Chmod(0o644); err != nil {
f.Close()
_ = f.Remove()
return fmt.Errorf("save: failed to set permissions: %w", err)
@@ -391,7 +390,7 @@ type tmpFile interface {

// newTmpFile purely exists to be replaced in tests.
var newTmpFile = func(dir, pattern string) (tmpFile, error) {
f, err := ioutil.TempFile(dir, pattern)
f, err := os.CreateTemp(dir, pattern)
if err != nil {
return nil, fmt.Errorf("failed to create temp file: %w", err)
}