Skip to content

Commit

Permalink
Merge pull request #14 from kitagry/show-all-user-not-found-error
Browse files Browse the repository at this point in the history
Return all user not found errors
  • Loading branch information
snowhork authored Jan 17, 2023
2 parents 75acdd3 + d1e5fe8 commit 2a931ae
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 711 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.19
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.19

- name: Test
run: go test -v ./...

- name: Lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2
version: v1.50.1
9 changes: 8 additions & 1 deletion cmd/impl/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

"github.com/pkg/errors"
"go.uber.org/multierr"
)

func AddCmd(client redashClient, users, groups []string) error {
Expand All @@ -17,14 +18,20 @@ func AddCmd(client redashClient, users, groups []string) error {
}

userIds := make([]int, len(users))
var errs []error
for i, u := range users {
id, err := findUserID(client, u)
if err != nil {
return errors.Wrap(err, "findUserID")
errs = append(errs, errors.Wrap(err, "findUserID"))
continue
}
userIds[i] = id
}

if len(errs) > 0 {
return multierr.Combine(errs...)
}

for i, g := range groupIds {
for j, u := range userIds {
_, err := client.AddMember(g, u)
Expand Down
3 changes: 1 addition & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -163,7 +163,6 @@ func setGlobalConfigFromViper() error {
func enterValue() (string, error) {
reader := bufio.NewReader(os.Stdin)
res, err := reader.ReadString('\n')

if err != nil {
return "", nil
}
Expand Down
28 changes: 25 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
module github.com/snowhork/rdiam

go 1.16
go 1.19

require (
github.com/kr/text v0.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.4.0
github.com/spf13/viper v1.10.1
github.com/stretchr/testify v1.7.1
go.uber.org/multierr v1.6.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit 2a931ae

Please sign in to comment.