Skip to content

Commit

Permalink
obey linter
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmuth committed Sep 3, 2017
1 parent 68be268 commit 4cb3ce8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM golang:1.8
WORKDIR /go/src/app
COPY . .

RUN go get -u github.com/alecthomas/gometalinter && gometalinter --install
RUN go-wrapper download # "go get -d -v ./..."
RUN go-wrapper install # "go install -v ./..."

Expand Down
2 changes: 1 addition & 1 deletion app.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func main() {
}

service := &Service{config.ServiceBaseURL, httpClient}
handler := &Handler{*service}
handler := &HTTPClientTestHandler{*service}
err = http.ListenAndServe(fmt.Sprintf(":%d", config.Port), NewRouter(handler))

if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"net/http"
)

// Handler handles requests
type Handler struct {
// HTTPClientTestHandler handles requests
type HTTPClientTestHandler struct {
Service Service
}

// ServeHTTP serves HTTP
func (handler Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func (handler HTTPClientTestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
u1 := uuid.NewV4()
serviceRequest := &ServiceRequest{RequestID: u1.String()}
log.WithField("requestid", serviceRequest.RequestID).Info("About to do service.Call")
Expand Down
2 changes: 1 addition & 1 deletion router.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
)

func NewRouter(handler *Handler) http.Handler {
func NewRouter(handler http.Handler) http.Handler {

serveMux := http.NewServeMux()

Expand Down
14 changes: 10 additions & 4 deletions scripts/build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,20 @@ function runTests() {
for pkg in $(go list ./... | grep -v /vendor/)
do
echo "pkg=$pkg"
richgo test -v -coverprofile=coverage/coverage.out -covermode=count $pkg
go test -v -coverprofile=coverage/coverage.out -covermode=count $pkg
if [ -f coverage/coverage.out ]; then
tail -n +2 coverage/coverage.out >> coverage/coverage-all.out
fi
done
richgo test -v -tags=integration -coverprofile=coverage/coverage.out -covermode=count
tail -n +2 coverage/coverage.out >> coverage/coverage-all.out
go tool cover -html=coverage/coverage-all.out -o coverage/coverage.html
go test -v -tags=integration -coverprofile=coverage/coverage.out -covermode=count
if [ -f coverage/coverage.out ]; then
tail -n +2 coverage/coverage.out >> coverage/coverage-all.out
fi

if [ -f coverage/coverage-all.out ]; then
go tool cover -html=coverage/coverage-all.out -o coverage/coverage.html
fi

)
}

Expand Down
2 changes: 1 addition & 1 deletion serviceresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

type ServiceResponse struct {
Qux string `json:"qux"`
Qux string `json:"qux"`
RequestID string `json:"requestid"`
}

Expand Down

0 comments on commit 4cb3ce8

Please sign in to comment.