Skip to content

Commit

Permalink
Add .goreleaser.yml and version (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pryz authored May 9, 2023
1 parent f0a8e3c commit 3020f69
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
19 changes: 19 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
project_name: wzprof
dist: ./goreleaser/dist

before:
hooks:
- go mod tidy

builds:
- main: ./cmd/wzprof/main.go
binary: wzprof
mod_timestamp: '{{ .CommitTimestamp }}'

ldflags:
- -X main.version={{.Version}}

release:
github:
owner: stealthrocket
name: wzprof
25 changes: 17 additions & 8 deletions cmd/wzprof/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,19 @@ func silenceContextCanceled(err error) error {
}

var (
pprofAddr string
cpuProfile string
memProfile string
sampleRate float64
hostProfile bool
hostTime bool
inuseMemory bool
mounts string
pprofAddr string
cpuProfile string
memProfile string
sampleRate float64
hostProfile bool
hostTime bool
inuseMemory bool
mounts string
printVersion bool
)

var version = "dev"

func init() {
log.Default().SetOutput(os.Stderr)
flag.StringVar(&pprofAddr, "pprof-addr", "", "Address where to expose a pprof HTTP endpoint.")
Expand All @@ -195,11 +198,17 @@ func init() {
flag.BoolVar(&hostTime, "iowait", false, "Include time spent waiting on I/O in guest CPU profile.")
flag.BoolVar(&inuseMemory, "inuse", false, "Include snapshots of memory in use (experimental).")
flag.StringVar(&mounts, "mount", "", "Comma-separated list of directories to mount (e.g. /tmp:/tmp:ro).")
flag.BoolVar(&printVersion, "version", false, "Print the wzprof version.")
}

func run(ctx context.Context) error {
flag.Parse()

if printVersion {
fmt.Printf("wzprof version %s\n", version)
return nil
}

args := flag.Args()
if len(args) != 1 {
// TODO: print flag usage
Expand Down

0 comments on commit 3020f69

Please sign in to comment.