From 7b9c9198d50e94f55db243e0e38f0ebd2705bf4e Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 24 May 2018 22:55:54 -0400 Subject: [PATCH 1/3] utils: make repo safe for "go build ./..." This directory contains two separate helper programs that can be run with "go run". It's not possible to cd into the directory and run "go build", because there are two different Go source files defining main.main. The canonical way to indicate this is to put a "// +build ignore" build tag at the top of such helper programs. Then they can still be run by go run decode_auth.go go run test_auth.go but will not be considered by "cd utils; go build" nor by commands like "go build ./..." or "go test ./..." in the root of the repo. --- utils/decode_auth.go | 2 ++ utils/test_auth.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/utils/decode_auth.go b/utils/decode_auth.go index 166b522..5fd8ba7 100644 --- a/utils/decode_auth.go +++ b/utils/decode_auth.go @@ -1,3 +1,5 @@ +// +build ignore + package main import ( diff --git a/utils/test_auth.go b/utils/test_auth.go index 057b0d7..ba0bdc6 100644 --- a/utils/test_auth.go +++ b/utils/test_auth.go @@ -1,3 +1,5 @@ +// +build ignore + package main import ( From 63466d3e78e8387802c9789b53a838e63455ec7e Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 24 May 2018 23:03:47 -0400 Subject: [PATCH 2/3] ntlm: fix two test print format bugs Go 1.10 now catches mistakes like these as part of "go test". These were making "go test" fail. --- ntlm/ntlmv1_test.go | 2 +- ntlm/ntlmv2_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ntlm/ntlmv1_test.go b/ntlm/ntlmv1_test.go index e175557..5e27d1d 100644 --- a/ntlm/ntlmv1_test.go +++ b/ntlm/ntlmv1_test.go @@ -62,7 +62,7 @@ func TestNtlmV1ExtendedSessionSecurity(t *testing.T) { context.SetServerChallenge(c.ServerChallenge) err = context.ProcessAuthenticateMessage(msg) if err == nil { - t.Errorf("This message should have failed to authenticate, but it passed", err) + t.Errorf("This message should have failed to authenticate, but it passed") } } diff --git a/ntlm/ntlmv2_test.go b/ntlm/ntlmv2_test.go index 0ec0532..b36f906 100644 --- a/ntlm/ntlmv2_test.go +++ b/ntlm/ntlmv2_test.go @@ -172,7 +172,7 @@ func TestNTLMv2WithDomain(t *testing.T) { err := server.ProcessAuthenticateMessage(a) if err != nil { - t.Error("Could not process authenticate message: %s\n", err) + t.Errorf("Could not process authenticate message: %s\n", err) } } From c5fd2d4d2b4df823cd43c0f4b5d683668894d3e0 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 24 May 2018 22:57:40 -0400 Subject: [PATCH 3/3] go-ntlm: add go.mod This file is used by vgo (go get -u golang.org/x/vgo) and will be understood by Go 1.11 and later too. Normally a go.mod file lists required dependencies of a module (think repository), but this module has no required dependencies, so the file only gives the module path. Defining the module path ensures that clients import the package under its canonical name, not under alternate casings such as import "github.com/thomsonREUTERSeIkOn/go-ntlm" which would otherwise work (since GitHub answers to that path). Having a go.mod file also makes it possible to work on this repository outside GOPATH when using vgo or Go 1.11. That is, the go.mod file makes it possible to git clone https://github.com/ThomsonReutersEikon/go-ntlm cd go-ntlm vgo build ./... vgo test ./... from anywhere, not just inside GOPATH. --- go.mod | 1 + 1 file changed, 1 insertion(+) create mode 100644 go.mod diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..00ec7d6 --- /dev/null +++ b/go.mod @@ -0,0 +1 @@ +module github.com/ThomsonReutersEikon/go-ntlm