Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Goreleaser #394

Merged
merged 1 commit into from
Feb 5, 2020
Merged
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
Goreleaser
When publishing binaries using Goreleaser use build flags.

Also remove custom archives and checksum name_templates because
Goreleaser has reasonable defaults, see https://goreleaser.com/customization/#Archive
  • Loading branch information
Filip Nguyen committed Jan 31, 2020
commit b0b9cc89dd85698cbd2d03503047f068c43ff183
15 changes: 7 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ builds:
- GOPROXY=https://proxy.golang.org
- GOSUMDB=sum.golang.org
main: ./mockgen/
archive:
format: tar.gz
wrap_in_directory: true
name_template: '{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
files:
- LICENSE
- README.md

archives:
- format: tar.gz
wrap_in_directory: true
files:
- LICENSE
- README.md
checksum:
name_template: '{{ .Binary }}-{{ .Version }}-checksums.txt'
snapshot:
name_template: "snap-{{ .Commit }}"
changelog:
Expand Down
18 changes: 16 additions & 2 deletions mockgen/mockgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ const (
gomockImportPath = "github.com/golang/mock/gomock"
)

var (
version = ""
commit = "none"
date = "unknown"
)

var (
source = flag.String("source", "", "(source mode) Input Go source file; enables source mode.")
destination = flag.String("destination", "", "Output file; defaults to stdout.")
Expand All @@ -55,14 +61,14 @@ var (
copyrightFile = flag.String("copyright_file", "", "Copyright file used to add copyright header")

debugParser = flag.Bool("debug_parser", false, "Print out parser results only.")
version = flag.Bool("version", false, "Print version.")
showVersion = flag.Bool("version", false, "Print version.")
)

func main() {
flag.Usage = usage
flag.Parse()

if *version {
if *showVersion {
printVersion()
return
}
Expand Down Expand Up @@ -621,3 +627,11 @@ func lookupPackageName(importPath string) (string, bool) {
}
return pkg.Name, true
}

func printVersion() {
if version != "" {
fmt.Printf("v%s\nCommit: %s\nDate: %s\n", version, commit, date)
} else {
printModuleVersion()
}
}
2 changes: 1 addition & 1 deletion mockgen/version.1.11.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"log"
)

func printVersion() {
func printModuleVersion() {
log.Printf("No version information is available for Mockgen compiled with " +
"version 1.11")
}
2 changes: 1 addition & 1 deletion mockgen/version.1.12.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"runtime/debug"
)

func printVersion() {
func printModuleVersion() {
if bi, exists := debug.ReadBuildInfo(); exists {
fmt.Println(bi.Main.Version)
} else {
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy