Skip to content

Commit 646cc3f

Browse files
authored
Merge pull request #8 from ifad/goreleaser
Goreleaser
2 parents 310b8d7 + f1a6213 commit 646cc3f

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
bin/*
2+
dist/*
23
pkg/*
34
src/gopkg.in/*
45
src/github.com/*

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
go:
2-
- 1.5
3-
- 1.6
2+
- 1.8
43

54
language: go
65

@@ -9,3 +8,6 @@ install:
98

109
script:
1110
- make test
11+
12+
after_success:
13+
test -n "$TRAVIS_TAG" && make release

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ gcfg:
2424

2525
testify:
2626
[ -d src/gopkg.in/testify.v1 ] || go get gopkg.in/stretchr/testify.v1
27+
28+
release:
29+
curl -sL https://git.io/goreleaser | bash

goreleaser.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
build:
2+
main: clammit
3+
binary_name: clammit
4+
goos:
5+
- linux
6+
goarch:
7+
- amd64
8+
- arm
9+
- arm64

src/clammit/main.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ import (
2727
"syscall"
2828
)
2929

30+
/* This is for Go Releaser.
31+
* https://github.com/goreleaser/goreleaser#a-note-about-mainversion
32+
*/
33+
var version = "master"
34+
3035
//
3136
// Configuration structure, designed for gcfg
3237
//
@@ -114,9 +119,10 @@ type Ctx struct {
114119
// JSON server information response
115120
//
116121
type Info struct {
122+
Version string `json:"clammit_version"`
117123
Address string `json:"scan_server_url"`
118124
PingResult string `json:"ping_result"`
119-
Version string `json:"version"`
125+
ScannerVersion string `json:"scan_server_version"`
120126
TestScanVirusResult string `json:"test_scan_virus"`
121127
TestScanCleanResult string `json:"test_scan_clean"`
122128
}
@@ -354,16 +360,17 @@ func infoHandler(w http.ResponseWriter, req *http.Request) {
354360

355361
info := &Info{
356362
Address: ctx.Scanner.Address(),
363+
Version: version,
357364
}
358365
if err := ctx.Scanner.Ping(); err != nil {
359366
info.PingResult = err.Error()
360367
} else {
361368
info.PingResult = "Connected to server OK"
362369
if response, err := ctx.Scanner.Version(); err != nil {
363-
info.Version = err.Error()
370+
info.ScannerVersion = err.Error()
364371
} else {
365372
for s := range response {
366-
info.Version += s
373+
info.ScannerVersion += s
367374
}
368375
}
369376
/*

0 commit comments

Comments
 (0)