Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit 6b1c9a7

Browse files
authored
chore: upgrade and reduce dependencies (#45)
1 parent 29bd61f commit 6b1c9a7

File tree

4 files changed

+469
-185
lines changed

4 files changed

+469
-185
lines changed

cmd/cmd_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package cmd
22

33
import (
4-
"github.com/magiconair/properties/assert"
54
"testing"
5+
6+
"github.com/stretchr/testify/assert"
67
)
78

89
func TestCmdBuilder(t *testing.T) {

cmd/root.go

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ import (
55
"bytes"
66
"fmt"
77
"io"
8-
"io/ioutil"
8+
"math/rand"
99
"os"
1010
"os/exec"
1111
"path/filepath"
1212
"strings"
1313
"sync"
1414

15-
"github.com/ory/viper"
16-
"github.com/pborman/uuid"
1715
"github.com/spf13/cobra"
16+
"github.com/spf13/viper"
1817
)
1918

2019
func check(err error) {
@@ -122,7 +121,7 @@ GO_TEST_BINARY="gotest"
122121

123122
files := make([]string, len(packages))
124123
for k, pkg := range packages {
125-
files[k] = filepath.Join(os.TempDir(), uuid.New()) + ".cc.tmp"
124+
files[k] = filepath.Join(os.TempDir(), fmt.Sprintf("%d.cc.tmp", rand.Uint64()))
126125

127126
gotest := os.Getenv("GO_TEST_BINARY")
128127
if gotest == "" {
@@ -157,7 +156,7 @@ GO_TEST_BINARY="gotest"
157156
continue
158157
}
159158

160-
p, err := ioutil.ReadFile(file)
159+
p, err := os.ReadFile(file)
161160
check(err)
162161

163162
ps := strings.Split(string(p), "\n")
@@ -167,7 +166,7 @@ GO_TEST_BINARY="gotest"
167166
output, err := cmd.Flags().GetString("output")
168167
check(err)
169168

170-
check(ioutil.WriteFile(output, []byte(payload), 0644))
169+
check(os.WriteFile(output, []byte(payload), 0644))
171170
return nil
172171
},
173172
}
@@ -208,25 +207,6 @@ func initConfig() {
208207

209208
}
210209

211-
type filter struct {
212-
dtl io.Writer
213-
}
214-
215-
func (f *filter) Write(p []byte) (n int, err error) {
216-
for _, ppp := range strings.Split(string(p), "\n") {
217-
if strings.Contains(ppp, "warning: no packages being tested depend on matches for pattern") {
218-
continue
219-
} else {
220-
nn, err := f.dtl.Write(p)
221-
n = n + nn
222-
if err != nil {
223-
return n, err
224-
}
225-
}
226-
}
227-
return len(p), nil
228-
}
229-
230210
type cmdBuilder struct {
231211
cmd string
232212
args []string

go.mod

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
1+
go 1.19
2+
13
module github.com/ory/go-acc
24

35
require (
4-
github.com/dgraph-io/ristretto v0.0.2 // indirect
5-
github.com/google/uuid v1.1.1 // indirect
6-
github.com/magiconair/properties v1.8.1
7-
github.com/mitchellh/mapstructure v1.3.2 // indirect
8-
github.com/ory/viper v1.7.5
9-
github.com/pborman/uuid v1.2.0
10-
github.com/pelletier/go-toml v1.8.0 // indirect
11-
github.com/spf13/afero v1.2.2 // indirect
12-
github.com/spf13/cast v1.3.1 // indirect
13-
github.com/spf13/cobra v1.0.0
6+
github.com/spf13/cobra v1.6.1
7+
github.com/spf13/viper v1.14.0
8+
github.com/stretchr/testify v1.8.1
9+
)
10+
11+
require (
12+
github.com/davecgh/go-spew v1.1.1 // indirect
13+
github.com/fsnotify/fsnotify v1.6.0 // indirect
14+
github.com/hashicorp/hcl v1.0.0 // indirect
15+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
16+
github.com/magiconair/properties v1.8.7 // indirect
17+
github.com/mitchellh/mapstructure v1.5.0 // indirect
18+
github.com/pelletier/go-toml v1.9.5 // indirect
19+
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
20+
github.com/pmezard/go-difflib v1.0.0 // indirect
21+
github.com/spf13/afero v1.9.3 // indirect
22+
github.com/spf13/cast v1.5.0 // indirect
1423
github.com/spf13/jwalterweatherman v1.1.0 // indirect
1524
github.com/spf13/pflag v1.0.5 // indirect
16-
github.com/stretchr/testify v1.5.1 // indirect
17-
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
18-
gopkg.in/ini.v1 v1.57.0 // indirect
25+
github.com/subosito/gotenv v1.4.1 // indirect
26+
golang.org/x/sys v0.3.0 // indirect
27+
golang.org/x/text v0.5.0 // indirect
28+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
29+
gopkg.in/ini.v1 v1.67.0 // indirect
30+
gopkg.in/yaml.v2 v2.4.0 // indirect
31+
gopkg.in/yaml.v3 v3.0.1 // indirect
1932
)
20-
21-
go 1.14

0 commit comments

Comments
 (0)