make releases
This commit is contained in:
parent
7a97c3ee78
commit
0e4282179f
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
/*.txt
|
||||
/*.pprof
|
||||
/dist/
|
@ -1,5 +1,4 @@
|
||||
run:
|
||||
deadline: 30s
|
||||
tests: true
|
||||
|
||||
linters-settings:
|
||||
|
68
.goreleaser.yml
Normal file
68
.goreleaser.yml
Normal file
@ -0,0 +1,68 @@
|
||||
---
|
||||
project_name: golangci-lint
|
||||
|
||||
release:
|
||||
github:
|
||||
owner: golangci
|
||||
name: golangci-lint
|
||||
|
||||
builds:
|
||||
- binary: golangci-lint
|
||||
goos: &goos
|
||||
- darwin
|
||||
- windows
|
||||
- linux
|
||||
goarch: &goarch
|
||||
- amd64
|
||||
- i386
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
main: ./cmd/golangci-lint/
|
||||
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
|
||||
|
||||
archive:
|
||||
format: tar.gz
|
||||
wrap_in_directory: true
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
name_template: '{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
|
||||
files:
|
||||
- LICENSE
|
||||
- README.md
|
||||
|
||||
snapshot:
|
||||
name_template: SNAPSHOT-{{ .Commit }}
|
||||
|
||||
checksum:
|
||||
name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt'
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
- 'README.md'
|
||||
- Merge pull request
|
||||
- Merge branch
|
||||
|
||||
dockers:
|
||||
- image: golangci/golangci-lint
|
||||
tag_templates:
|
||||
- '{{ .Tag }}'
|
||||
- 'v{{ .Major }}.{{ .Minor }}'
|
||||
- 'latest'
|
||||
|
||||
brew:
|
||||
github:
|
||||
owner: golangci
|
||||
name: golangci-lint-formula
|
||||
folder: Formula
|
||||
homepage: https://golangci.com
|
||||
description: Fast linters runner for Go.
|
||||
test: |
|
||||
system "#{bin}/golangci-lint --version"
|
||||
|
||||
git:
|
||||
short_hash: true
|
15
.travis.yml
15
.travis.yml
@ -4,3 +4,18 @@ go:
|
||||
- 1.9.x
|
||||
- 1.10.x
|
||||
script: make test
|
||||
|
||||
after_success:
|
||||
- test -n "$TRAVIS_TAG" && docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
||||
|
||||
# needed for the docker pipe
|
||||
services:
|
||||
- docker
|
||||
|
||||
deploy:
|
||||
- provider: script
|
||||
skip_cleanup: true
|
||||
script: curl -sL https://git.io/goreleaser | bash
|
||||
on:
|
||||
tags: true
|
||||
condition: $TRAVIS_GO_VERSION =~ ^1\.10\.[0-9]+$
|
3
Dockerfile
Normal file
3
Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM scratch
|
||||
COPY golangci-lint /
|
||||
ENTRYPOINT ["/golangci-lint"]
|
@ -4,8 +4,15 @@ import (
|
||||
"github.com/golangci/golangci-lint/pkg/commands"
|
||||
)
|
||||
|
||||
var (
|
||||
// Populated by goreleaser during build
|
||||
version = "master"
|
||||
commit = "?"
|
||||
date = ""
|
||||
)
|
||||
|
||||
func main() {
|
||||
e := commands.NewExecutor()
|
||||
e := commands.NewExecutor(version, commit, date)
|
||||
if err := e.Execute(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -11,9 +11,11 @@ type Executor struct {
|
||||
cfg *config.Config
|
||||
|
||||
exitCode int
|
||||
|
||||
version, commit, date string
|
||||
}
|
||||
|
||||
func NewExecutor() *Executor {
|
||||
func NewExecutor(version, commit, date string) *Executor {
|
||||
e := &Executor{
|
||||
cfg: &config.Config{},
|
||||
}
|
||||
@ -22,6 +24,10 @@ func NewExecutor() *Executor {
|
||||
e.initRun()
|
||||
e.initLinters()
|
||||
|
||||
e.version = version
|
||||
e.commit = commit
|
||||
e.date = date
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
|
||||
"github.com/golangci/golangci-lint/pkg/printers"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@ -21,6 +23,11 @@ func (e *Executor) initRoot() {
|
||||
}
|
||||
},
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
if e.cfg.Run.PrintVersion {
|
||||
fmt.Fprintf(printers.StdOut, "golangci-lint has version %s built from %s on %s\n", e.version, e.commit, e.date)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
runtime.GOMAXPROCS(e.cfg.Run.Concurrency)
|
||||
|
||||
log.SetFlags(0) // don't print time
|
||||
@ -62,6 +69,7 @@ func (e *Executor) initRoot() {
|
||||
rootCmd.PersistentFlags().StringVar(&e.cfg.Run.CPUProfilePath, "cpu-profile-path", "", "Path to CPU profile output file")
|
||||
rootCmd.PersistentFlags().StringVar(&e.cfg.Run.MemProfilePath, "mem-profile-path", "", "Path to memory profile output file")
|
||||
rootCmd.PersistentFlags().IntVarP(&e.cfg.Run.Concurrency, "concurrency", "j", runtime.NumCPU(), "Concurrency (default NumCPU)")
|
||||
rootCmd.PersistentFlags().BoolVar(&e.cfg.Run.PrintVersion, "version", false, "Print version")
|
||||
|
||||
e.rootCmd = rootCmd
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ type Run struct {
|
||||
ExitCodeIfIssuesFound int `mapstructure:"issues-exit-code"`
|
||||
AnalyzeTests bool `mapstructure:"tests"`
|
||||
Deadline time.Duration
|
||||
PrintVersion bool
|
||||
}
|
||||
|
||||
type LintersSettings struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user