Skip to content

Commit

Permalink
Merge pull request #1 from mittwald/maint/go-modules
Browse files Browse the repository at this point in the history
Maint/go modules
  • Loading branch information
Hermsi1337 authored Apr 26, 2019
2 parents 1a4a015 + 1cf9798 commit 87f6f56
Show file tree
Hide file tree
Showing 12 changed files with 266 additions and 362 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Makefile]
indent_style = tab
34 changes: 3 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Folders
_obj
_test

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*

_testmain.go

*.exe
*.test
*.prof

vendor/
bin/
.idea/

protodep.lock
artifacts/
proto/
protodep
dist/
service/protodep.lock
34 changes: 34 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
before:
hooks:
- go mod download
- go vet ./...
- go test -v ./...
builds:
-
env:
- CGO_ENABLED=0
- GO111MODULE=on
binary: protodep
goos:
- darwin
- linux
goarch:
- amd64
archives:
-
replacements:
darwin: macOS
linux: linux
windows: windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
language: go

go:
- '1.12'

before_script:
- sudo sysctl -w net.ipv4.ip_forward=1

services:
- docker

env:
global:
- GO111MODULE=on
- CGO_ENABLED=0
- GO_VERSION=1.12
- secure: "SB7DKQgTBoqU+Jfc83y4n/H2NES/PrGD+7UCYy69lXyK354WKWTxtvHrEkecga0UiJAI9v1diwZiu5YEiJ0nLuk5vh9Jq9I47n7Y5sTRECn3h2UhqnuoVTGeULOKtAuRHlAZ+JG1eC9MsqG7SpENnS7HMJepoNfZZ7WrSPNVOE5GFR7ErdhR/tBahWPbXuAbtjhKdS6/LEsoxWf3aJAF98UEbEOYR8kXkUcXtdF5C6UX4R+X+5C+mU/JHTHK9dEpJehz2XSSAxsTY9ORvKPuL+JF2M2SoC2yTntZ7TBBiWsuwqszG4f33qk4p8H87tZjoHJiJpnN4hJBw8hL18+SrFM7adU1QcmKK+/iNMU2HO5KilAPleFKXhUX356sGvk8pXoqZEGvAAtzNr+Fwqwtpe+Df+fYzimHp2a0wqaIq6kf66CGlDLv6hKy10nh36Y2Wh3KHEywrbJEurXEOomtvy5p4o88wpv5PD5Q1mZZP2HxCdzaKAbyk/4UJ0BElbVwkUW38s5McWGUZxCSlURc9xrRoCWo2Kx4mn+29GEer8JNIzFzR8k6Slh+K1tGrzuUiG0gl7dt0UY+Ij+NbBSTnMDg3A3XnAOajolYdqQstVlFxhXJ+7MgCyk24Ksm2uAv6Z1n94FgPWBP249Za/WORwkzyILlD8CZHULtn9qMB74="
script:
- curl -sL https://git.io/goreleaser | bash -s -- --snapshot --skip-publish --rm-dist

deploy:
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash -s -- --snapshot --skip-publish --rm-dist
on:
tags: false
branch: master
condition: $TRAVIS_OS_NAME = linux
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash -s -- --rm-dist
on:
tags: true
condition: $TRAVIS_OS_NAME = linux
153 changes: 0 additions & 153 deletions Gopkg.lock

This file was deleted.

58 changes: 0 additions & 58 deletions Gopkg.toml

This file was deleted.

55 changes: 15 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,47 +1,22 @@
APP=protodep
BASE_PACKAGE=github.com/stormcat24/$(APP)
SERIAL_PACKAGES= \
cmd \
dependency \
helper \
repository \
service
TARGET_SERIAL_PACKAGES=$(addprefix test-,$(SERIAL_PACKAGES))
export PATH := ${GOPATH}/bin:${PATH}
BUILD_ARGS := -a -installsuffix cgo -ldflags="-w -s"
BINARY_NAME := protodep

deps-build:
go get -u github.com/golang/dep/cmd/dep
go get github.com/golang/lint/golint
.PHONY: all dep test vet compile goreleaser

deps: deps-build
dep ensure
all: dep compile

deps-update: deps-build
rm -rf ./vendor
rm -rf Gopkg.lock
dep ensure -update
dep:
go mod download

define build-artifact
GOOS=$(1) GOARCH=$(2) go build -o artifacts/$(APP)
cd artifacts && tar cvzf $(APP)_$(1)_$(2).tar.gz $(APP)
rm ./artifacts/$(APP)
@echo [INFO]build success: $(1)_$(2)
endef
test:
go test -v ./...

build-all:
$(call build-artifact,linux,386)
$(call build-artifact,linux,amd64)
$(call build-artifact,linux,arm)
$(call build-artifact,linux,arm64)
$(call build-artifact,darwin,amd64)
vet:
go vet ./...

build:
go build -ldflags="-w -s" -o bin/protodep main.go
compile:
go build $(BUILD_ARGS) -o $(BINARY_NAME)

test: $(TARGET_SERIAL_PACKAGES)

$(TARGET_SERIAL_PACKAGES): test-%:
go test $(BASE_PACKAGE)/$(*)

mock:
go get github.com/golang/mock/mockgen
mockgen -source helper/auth.go -package helper -destination helper/auth_mock.go
goreleaser:
curl -sL https://git.io/goreleaser | bash -s -- --snapshot --skip-publish --rm-dist
Loading

0 comments on commit 87f6f56

Please sign in to comment.