diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fe44d05 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +sk-job +.vscode +.idea +lastupdate.tmp diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..1a0545d --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,54 @@ +# 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 vgo + # - go mod download +builds: +- env: + - CGO_ENABLED=0 +- id: binary + goos: + - windows + - darwin + - linux + goarch: + - amd64 + - arm + - arm64 + - 386 + goarm: + - 6 + - 7 + ldflags: + - -a -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.buildSource=binaryRelease +- id: snap + goos: + - linux + goarch: + - amd64 + - arm + - arm64 + - 386 + goarm: + - 6 + - 7 + ldflags: + - -a -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.buildSource=snap +archives: +- builds: + - binary + replacements: + linux: Linux + windows: Windows + format_overrides: + - goos: windows + format: zip +checksum: + name_template: 'checksums.txt' +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..30d9a87 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +- repo: git://github.com/dnephin/pre-commit-golang + sha: master + hooks: + - id: go-fmt + exclude: 'vendor' + - id: go-vet + - id: go-lint + exclude: 'vendor' diff --git a/License b/License new file mode 100644 index 0000000..b579d85 --- /dev/null +++ b/License @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 jonyhy96 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..812870a --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +#! /usr/bin/make -f + +.PHONY: all +all: package + +.PHONY: test +test: + go test -tags=unit -timeout 30s -short -v `go list ./... | grep -v /vendor/` + +.PHONY: init +init: + pre-commit install + +.PHONY: package +package: clean build release + +.PHONY: build +build: + CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o replacer . + +.PHONY: release +release: + goreleaser + +.PHONY: clean +clean: + rm -f dist; diff --git a/README.md b/README.md new file mode 100644 index 0000000..9450a61 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# replacer +[![Go Report Card](https://goreportcard.com/badge/github.com/jonyhy96/replacer)](https://goreportcard.com/report/github.com/jonyhy96/replacer) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + +replacer helps you to batch replace files + +## Getting Started + +These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. + +``` +$ go get github.com/jonyhy96/replacer +$ replacer -h +$ replacer -f ./keys.json -w . +``` + +### Prerequisites + +For develop + + - go ^1.10 + +### Installing + +``` +$ go build -o replacer . +$ sudo mv replacer /usr/local/bin +``` + +### Params + +| param | required | e.g. | +| :--------: | :-----: | :----: | +| f | true | -f ./keys.json | +| w | true | -w . | + +### Coding style + +[CODEFMT](https://github.com/golang/go/wiki/CodeReviewComments) + +## Contributing + +Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. + +## Versioning + +We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://gitlab.domain.com/golang/containerM/tags). + +## Authors + +* **HAO YUN** - *Initial work* - [haoyun](https://github.com/jonyhy96) + +See also the list of [contributors](CONTRIBUTORS.md) who participated in this project. + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details + +## Acknowledgments + +* nothing