-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from vbatts/mage
Housekeeping!
- Loading branch information
Showing
420 changed files
with
186 additions
and
214,713 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
module github.com/vbatts/tar-split | ||
|
||
go 1.15 | ||
|
||
require golang.org/x/sys v0.0.0-20220906165534-d0df966e6959 // indirect | ||
go 1.17 | ||
|
||
require ( | ||
github.com/fatih/color v1.15.0 | ||
github.com/magefile/mage v1.14.0 | ||
github.com/sirupsen/logrus v1.9.0 | ||
github.com/urfave/cli v1.22.12 | ||
) | ||
|
||
require ( | ||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.17 // indirect | ||
github.com/russross/blackfriday/v2 v2.1.0 // indirect | ||
golang.org/x/sys v0.6.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// +build ignore | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
"github.com/magefile/mage/mage" | ||
) | ||
|
||
func main() { os.Exit(mage.Main()) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//go:build mage | ||
// +build mage | ||
|
||
package main | ||
|
||
import ( | ||
"io" | ||
"os" | ||
|
||
"github.com/fatih/color" | ||
) | ||
|
||
var ( | ||
ourStdout = cw{c: color.New(color.FgGreen), o: os.Stdout} | ||
ourStderr = cw{c: color.New(color.FgRed), o: os.Stderr} | ||
) | ||
|
||
// hack around color.Color not implementing Write() | ||
type cw struct { | ||
c *color.Color | ||
o io.Writer | ||
} | ||
|
||
func (cw cw) Write(p []byte) (int, error) { | ||
i := len(p) | ||
_, err := cw.c.Fprint(cw.o, string(p)) // discarding the number of bytes written for now... | ||
return i, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
//go:build mage | ||
// +build mage | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
|
||
"github.com/magefile/mage/mg" // mg contains helpful utility functions, like Deps | ||
) | ||
|
||
var ( | ||
// Default target to run when none is specified | ||
// If not set, running mage will list available targets | ||
Default = Build | ||
app string = "tar-split" | ||
Stdout = ourStdout | ||
Stderr = ourStderr | ||
|
||
golangcilintVersion = "v1.51.2" | ||
) | ||
|
||
// Run all-the-things | ||
func All() error { | ||
mg.Deps(Vet) | ||
mg.Deps(Test) | ||
mg.Deps(Build) | ||
mg.Deps(Lint) | ||
return nil | ||
} | ||
|
||
// A build step that requires additional params, or platform specific steps for example | ||
func Build() error { | ||
mg.Deps(InstallDeps) | ||
fmt.Println("Building...") | ||
cmd := exec.Command("go", "build", "-v", "-o", app, "./cmd/tar-split") | ||
cmd.Stdout = Stdout | ||
cmd.Stderr = Stderr | ||
return cmd.Run() | ||
} | ||
|
||
// Vet the codes | ||
func Vet() error { | ||
fmt.Println("go vet...") | ||
cmd := exec.Command("go", "vet", "./...") | ||
cmd.Stdout = Stdout | ||
cmd.Stderr = Stderr | ||
return cmd.Run() | ||
} | ||
|
||
// Run the Linters | ||
func Lint() error { | ||
mg.Deps(InstallToolsLint) | ||
fmt.Println("Linting...") | ||
cmd := exec.Command("golangci-lint", "run") | ||
cmd.Stdout = Stdout | ||
cmd.Stderr = Stderr | ||
return cmd.Run() | ||
} | ||
|
||
// Run the tests available | ||
func Test() error { | ||
fmt.Println("Testing...") | ||
cmd := exec.Command("go", "test", "-v", "./...") | ||
cmd.Stdout = Stdout | ||
cmd.Stderr = Stderr | ||
return cmd.Run() | ||
} | ||
|
||
// A custom install step if you need your bin someplace other than go/bin | ||
func Install() error { | ||
mg.Deps(Build) | ||
fmt.Println("Installing...") | ||
return os.Rename(app, "/usr/local/bin/"+app) | ||
} | ||
|
||
// Manage your deps, or running package managers. | ||
func InstallDeps() error { | ||
mg.Deps(Tidy) | ||
fmt.Println("Installing Deps...") | ||
cmd := exec.Command("go", "get", "./...") | ||
cmd.Stdout = Stdout | ||
cmd.Stderr = Stderr | ||
return cmd.Run() | ||
} | ||
|
||
// Tools used during build/dev/test | ||
func InstallTools() error { | ||
mg.Deps(InstallToolsLint) | ||
return nil | ||
} | ||
|
||
func InstallToolsLint() error { | ||
fmt.Println("Installing Deps...") | ||
cmd := exec.Command("go", "install", "github.com/golangci/golangci-lint/cmd/golangci-lint@"+golangcilintVersion) | ||
cmd.Stdout = Stdout | ||
cmd.Stderr = Stderr | ||
return cmd.Run() | ||
} | ||
|
||
// Tidy go modules | ||
func Tidy() error { | ||
fmt.Println("Tidy up...") | ||
cmd := exec.Command("go", "mod", "tidy") | ||
cmd.Stdout = Stdout | ||
cmd.Stderr = Stderr | ||
return cmd.Run() | ||
} | ||
|
||
// Clean up after yourself | ||
func Clean() { | ||
fmt.Println("Cleaning...") | ||
os.RemoveAll(app) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.