-
Notifications
You must be signed in to change notification settings - Fork 20
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 #22 from fatih/add-goreleser
Add goreleaser support and -V flag for printing the version
- Loading branch information
Showing
4 changed files
with
105 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
project_name: faillint | ||
release: | ||
prerelease: auto # don't publish release with -rc1,-pre, etc suffixes | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
ldflags: | ||
- -s -w -X main.version={{.Version}} -X main.date={{.Date}} | ||
binary: "faillint" | ||
nfpms: | ||
- maintainer: Fatih Arslan | ||
description: Report unwanted Go import path and declaration usages | ||
homepage: https://github.com/fatih/faillint | ||
license: BSD 3-Clause | ||
formats: | ||
- deb | ||
- rpm | ||
replacements: | ||
darwin: macOS | ||
archives: | ||
- replacements: | ||
darwin: macOS | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' |
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,31 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/fatih/faillint/faillint" | ||
"golang.org/x/tools/go/analysis/singlechecker" | ||
) | ||
|
||
var ( | ||
version string | ||
date string | ||
) | ||
|
||
func main() { | ||
// this is a small hack to implement the -V flag that is part of | ||
// go/analysis framework. It'll allow us to print the version with -V, but | ||
// the --help message will print the flags of the analyzer | ||
ff := flag.NewFlagSet("faillint", flag.ContinueOnError) | ||
v := ff.Bool("V", false, "print version and exit") | ||
ff.Usage = func() {} | ||
ff.Parse(os.Args[1:]) | ||
if *v { | ||
fmt.Printf("faillint version %s (%s)\n", version, date) | ||
os.Exit(0) | ||
} | ||
|
||
singlechecker.Main(faillint.NewAnalyzer()) | ||
} |