summaryrefslogtreecommitdiff
path: root/vendor/github.com/sirupsen/logrus/magefile.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-17 13:17:34 -0500
committerGitHub <noreply@github.com>2021-02-17 13:17:34 -0500
commit6ea9ff2f21b583e4bc61a72d97c889ee7057a32e (patch)
treed378b355d2357ec41e03d4c7ead9d359a9336345 /vendor/github.com/sirupsen/logrus/magefile.go
parent516dc6d1ff618019079bc68055dd7f6c2a447aa2 (diff)
parent6842907250e84b2b315a7fa609b52f20258ebfa1 (diff)
downloadpodman-6ea9ff2f21b583e4bc61a72d97c889ee7057a32e.tar.gz
podman-6ea9ff2f21b583e4bc61a72d97c889ee7057a32e.tar.bz2
podman-6ea9ff2f21b583e4bc61a72d97c889ee7057a32e.zip
Merge pull request #9406 from containers/dependabot/go_modules/github.com/sirupsen/logrus-1.7.1
Bump github.com/sirupsen/logrus from 1.7.0 to 1.7.1
Diffstat (limited to 'vendor/github.com/sirupsen/logrus/magefile.go')
-rw-r--r--vendor/github.com/sirupsen/logrus/magefile.go77
1 files changed, 77 insertions, 0 deletions
diff --git a/vendor/github.com/sirupsen/logrus/magefile.go b/vendor/github.com/sirupsen/logrus/magefile.go
new file mode 100644
index 000000000..9aa603939
--- /dev/null
+++ b/vendor/github.com/sirupsen/logrus/magefile.go
@@ -0,0 +1,77 @@
+// +build mage
+
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "os"
+ "path"
+
+ "github.com/magefile/mage/mg"
+ "github.com/magefile/mage/sh"
+)
+
+// getBuildMatrix returns the build matrix from the current version of the go compiler
+func getBuildMatrix() (map[string][]string, error) {
+ jsonData, err := sh.Output("go", "tool", "dist", "list", "-json")
+ if err != nil {
+ return nil, err
+ }
+ var data []struct {
+ Goos string
+ Goarch string
+ }
+ if err := json.Unmarshal([]byte(jsonData), &data); err != nil {
+ return nil, err
+ }
+
+ matrix := map[string][]string{}
+ for _, v := range data {
+ if val, ok := matrix[v.Goos]; ok {
+ matrix[v.Goos] = append(val, v.Goarch)
+ } else {
+ matrix[v.Goos] = []string{v.Goarch}
+ }
+ }
+
+ return matrix, nil
+}
+
+func CrossBuild() error {
+ matrix, err := getBuildMatrix()
+ if err != nil {
+ return err
+ }
+
+ for os, arches := range matrix {
+ for _, arch := range arches {
+ env := map[string]string{
+ "GOOS": os,
+ "GOARCH": arch,
+ }
+ if mg.Verbose() {
+ fmt.Printf("Building for GOOS=%s GOARCH=%s\n", os, arch)
+ }
+ if err := sh.RunWith(env, "go", "build", "./..."); err != nil {
+ return err
+ }
+ }
+ }
+ return nil
+}
+
+func Lint() error {
+ gopath := os.Getenv("GOPATH")
+ if gopath == "" {
+ return fmt.Errorf("cannot retrieve GOPATH")
+ }
+
+ return sh.Run(path.Join(gopath, "bin", "golangci-lint"), "run", "./...")
+}
+
+// Run the test suite
+func Test() error {
+ return sh.RunWith(map[string]string{"GORACE": "halt_on_error=1"},
+ "go", "test", "-race", "-v", "./...")
+}