Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
bin/*
dist/*
pkg/*
src/gopkg.in/*
src/github.com/*
Expand Down
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
go:
- 1.5
- 1.6
- 1.8

language: go

Expand All @@ -9,3 +8,6 @@ install:

script:
- make test

after_success:
test -n "$TRAVIS_TAG" && make release
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ gcfg:

testify:
[ -d src/gopkg.in/testify.v1 ] || go get gopkg.in/stretchr/testify.v1

release:
curl -sL https://git.io/goreleaser | bash
9 changes: 9 additions & 0 deletions goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build:
main: clammit
binary_name: clammit
goos:
- linux
goarch:
- amd64
- arm
- arm64
13 changes: 10 additions & 3 deletions src/clammit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ import (
"syscall"
)

/* This is for Go Releaser.
* https://github.com/goreleaser/goreleaser#a-note-about-mainversion
*/
var version = "master"

//
// Configuration structure, designed for gcfg
//
Expand Down Expand Up @@ -114,9 +119,10 @@ type Ctx struct {
// JSON server information response
//
type Info struct {
Version string `json:"clammit_version"`
Address string `json:"scan_server_url"`
PingResult string `json:"ping_result"`
Version string `json:"version"`
ScannerVersion string `json:"scan_server_version"`
TestScanVirusResult string `json:"test_scan_virus"`
TestScanCleanResult string `json:"test_scan_clean"`
}
Expand Down Expand Up @@ -354,16 +360,17 @@ func infoHandler(w http.ResponseWriter, req *http.Request) {

info := &Info{
Address: ctx.Scanner.Address(),
Version: version,
}
if err := ctx.Scanner.Ping(); err != nil {
info.PingResult = err.Error()
} else {
info.PingResult = "Connected to server OK"
if response, err := ctx.Scanner.Version(); err != nil {
info.Version = err.Error()
info.ScannerVersion = err.Error()
} else {
for s := range response {
info.Version += s
info.ScannerVersion += s
}
}
/*
Expand Down