Browse Source

add goreleaser package

master
ojizero 2 years ago
parent
commit
5f98ec040a
  1. 3
      .gitignore
  2. 35
      .goreleaser.yml
  3. 14
      cmd/main.go

3
.gitignore vendored

@ -22,4 +22,7 @@ @@ -22,4 +22,7 @@
/vendor/
/Godeps/
### GoReleaser ###
dist
# End of https://www.gitignore.io/api/go

35
.goreleaser.yml

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
before:
hooks:
- go mod download
builds:
- env:
- CGO_ENABLED=0
main: ./cmd/main.go
goos:
- linux
- darwin
- windows
goarch:
- amd64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
brews:
- github:
owner: ojizero
name: homebrew-tap
folder: Formula
homepage: https://github.com/ojizer/gofindup
description: Simple find up utility

14
cmd/main.go

@ -2,22 +2,36 @@ package main @@ -2,22 +2,36 @@ package main
import (
"fmt"
"os"
flag "github.com/spf13/pflag"
"github.com/ojizero/gofindup"
)
var (
version = "dev"
commit = "HEAD"
date = "unknown"
)
func main() {
var (
startdir string
nametofind string
printversion bool
)
flag.BoolVarP(&printversion, "version", "v", false, "Display version info and exit program")
flag.StringVarP(&startdir, "startdir", "s", "", "Directory to start searching from, if not given would search from current working directory")
flag.Parse()
nametofind = flag.Arg(0)
if printversion {
fmt.Printf("Version: %v, Build commit: %v, Released on: %v\n", version, commit, date)
os.Exit(0)
}
findup := gofindup.Findup
if startdir != "" {
findup = func(name string) (string, error) {

Loading…
Cancel
Save