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

Support go modules #28

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
language: go
sudo: false
go:
- 1.7.x
- 1.8.x
- 1.13.x

install:
- go get github.com/coreos/etcd
Expand Down
14 changes: 13 additions & 1 deletion configmap/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
package configmap_test

import (
"fmt"
"path/filepath"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -66,7 +69,16 @@ func (s *updaterTestSuite) TearDownTest() {

func (s *updaterTestSuite) copyTestDataToDir() {
copyCmd := exec.Command("cp", "--archive", "testdata", s.tempDir)
require.NoError(s.T(), copyCmd.Run(), "copying testdata directory to tempdir must not fail")
e := copyCmd.Run()
fmt.Println(copyCmd.String(), e)
require.NoError(s.T(), e, "copying testdata directory to tempdir must not fail")
// We are storing file testdata/9989_09_09_07_32_32.099817316 and renaming it to testdata/..9989_09_09_07_32_32.099817316,
// because go modules don't allow repos with files with .. in their filename. See https://github.com/golang/go/issues/27299.
for _, p := range []string{firstGoodDir, secondGoodDir, badStaticDir} {
pOld := filepath.Join(s.tempDir, "testdata", strings.TrimPrefix(p, ".."))
pNew := filepath.Join(s.tempDir, "testdata", p)
require.NoError(s.T(), os.Rename(pOld, pNew), "renaming %q to %q failed", pOld, pNew)
}
}

func (s *updaterTestSuite) linkDataDirTo(newDataDir string) {
Expand Down
31 changes: 31 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module github.com/mwitkow/go-flagz

go 1.13

require (
github.com/coreos/bbolt v0.0.0-00010101000000-000000000000 // indirect
github.com/coreos/etcd v3.3.25+incompatible
github.com/coreos/go-semver v0.3.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.4.7
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/protobuf v1.5.2
github.com/grpc-ecosystem/grpc-gateway v1.14.6 // indirect
github.com/mwitkow/go-etcd-harness v0.0.0-20160325212926-4dc1cb3e1ff9
github.com/prometheus/client_golang v1.10.0
github.com/prometheus/common v0.20.0 // indirect
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
go.uber.org/zap v1.16.0 // indirect
golang.org/x/net v0.0.0-20200625001655-4c5254603344
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 // indirect
google.golang.org/grpc v1.32.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace (
github.com/coreos/bbolt => go.etcd.io/bbolt v1.3.4
github.com/coreos/etcd => go.etcd.io/etcd v3.3.25+incompatible
google.golang.org/grpc => google.golang.org/grpc v1.26.0
)
491 changes: 491 additions & 0 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions monitoring/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

"github.com/mwitkow/go-flagz"
"github.com/mwitkow/go-flagz/monitoring"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
flag "github.com/spf13/pflag"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
Expand All @@ -31,7 +31,7 @@ type monitoringTestSuite struct {
}

func TestMonitoringTestSuite(t *testing.T) {
suite.Run(t, &monitoringTestSuite{promHandler: prometheus.Handler()})
suite.Run(t, &monitoringTestSuite{promHandler: promhttp.Handler()})
}

func (s *monitoringTestSuite) SetupTest() {
Expand Down