mirror of
https://github.com/cybozu-go/transocks.git
synced 2026-09-14 11:05:49 +05:00
[feat]add goreleaser support
This commit is contained in:
parent
f4d0785d6b
commit
48c504dacb
2
.gitignore
vendored
2
.gitignore
vendored
@ -31,3 +31,5 @@ _testmain.go
|
||||
|
||||
# Ignore go.sum
|
||||
/go.sum
|
||||
.idea/
|
||||
dist/
|
||||
|
||||
62
.goreleaser.yml
Normal file
62
.goreleaser.yml
Normal file
@ -0,0 +1,62 @@
|
||||
# This is an example goreleaser.yaml file with some sane defaults.
|
||||
# Make sure to check the documentation at http://goreleaser.com
|
||||
before:
|
||||
hooks:
|
||||
# You may remove this if you don't use go modules.
|
||||
- go mod download
|
||||
# you may remove this if you don't need go generate
|
||||
- go generate ./...
|
||||
builds:
|
||||
- main: ./cmd/transocks/main.go
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
ldflags:
|
||||
- -X main.VERSION={{.Version}}
|
||||
goos:
|
||||
- windows
|
||||
- darwin
|
||||
- linux
|
||||
- freebsd
|
||||
goarch:
|
||||
- amd64
|
||||
- 386
|
||||
- arm
|
||||
- arm64
|
||||
goarm:
|
||||
- 6
|
||||
- 7
|
||||
ignore:
|
||||
- goos: windows
|
||||
goarch: arm
|
||||
- goos: windows
|
||||
goarch: arm64
|
||||
- goos: darwin
|
||||
goarch: arm
|
||||
- goos: darwin
|
||||
goarch: arm64
|
||||
- goos: freebsd
|
||||
goarch: arm
|
||||
- goos: freebsd
|
||||
goarch: arm64
|
||||
archives:
|
||||
- replacements:
|
||||
darwin: Darwin
|
||||
linux: Linux
|
||||
windows: Windows
|
||||
386: i386
|
||||
amd64: x86_64
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
files:
|
||||
- README*.md
|
||||
- LICENSE
|
||||
- ./cmd/transocks/*.toml
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.1.2] - 2020-03-10
|
||||
|
||||
### Added
|
||||
- Add goreleaser support
|
||||
- Add version flag for transocks cmd
|
||||
|
||||
## [1.1.1] - 2019-03-16
|
||||
|
||||
### Changed
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
"github.com/cybozu-go/log"
|
||||
@ -23,8 +24,10 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
VERSION = "Unknown"
|
||||
configFile = flag.String("f", "/etc/transocks.toml",
|
||||
"TOML configuration file path")
|
||||
showVersion = flag.Bool("v", false, "show version and exit")
|
||||
)
|
||||
|
||||
func loadConfig() (*transocks.Config, error) {
|
||||
@ -74,6 +77,11 @@ func serve(lns []net.Listener, c *transocks.Config) {
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if *showVersion {
|
||||
fmt.Println(VERSION)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
c, err := loadConfig()
|
||||
if err != nil {
|
||||
log.ErrorExit(err)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user