From 03b8be0b16e1ce9393d0d960c3494d65a974c60c Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Sun, 27 Jun 2021 03:23:51 +0900 Subject: [PATCH 1/2] add //go:build lines ref. https://golang.org/design/draft-gobuild --- connector.go | 1 + fakedb_go110_test.go | 1 + find_caller.go | 1 + find_caller_go111.go | 1 + proxy_test.go | 1 + tracer_test.go | 1 + 6 files changed, 6 insertions(+) diff --git a/connector.go b/connector.go index a9324b5..9137a06 100644 --- a/connector.go +++ b/connector.go @@ -1,3 +1,4 @@ +//go:build go1.10 // +build go1.10 package proxy diff --git a/fakedb_go110_test.go b/fakedb_go110_test.go index 4462a80..4a1e48b 100644 --- a/fakedb_go110_test.go +++ b/fakedb_go110_test.go @@ -1,3 +1,4 @@ +//go:build go1.10 // +build go1.10 package proxy diff --git a/find_caller.go b/find_caller.go index 61c1098..82e2ec6 100644 --- a/find_caller.go +++ b/find_caller.go @@ -1,3 +1,4 @@ +//go:build go1.12 // +build go1.12 package proxy diff --git a/find_caller_go111.go b/find_caller_go111.go index 97bb063..80b20fa 100644 --- a/find_caller_go111.go +++ b/find_caller_go111.go @@ -1,3 +1,4 @@ +//go:build !go1.12 // +build !go1.12 package proxy diff --git a/proxy_test.go b/proxy_test.go index 4a6d887..2a64504 100644 --- a/proxy_test.go +++ b/proxy_test.go @@ -1,3 +1,4 @@ +//go:build go1.10 // +build go1.10 package proxy diff --git a/tracer_test.go b/tracer_test.go index b03d4ec..8d13109 100644 --- a/tracer_test.go +++ b/tracer_test.go @@ -1,3 +1,4 @@ +//go:build go1.10 // +build go1.10 package proxy_test From 52f2d616c67d2f526bd13bbd7f78a706d63b40b2 Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Sun, 27 Jun 2021 06:57:29 +0900 Subject: [PATCH 2/2] fix the test --- tracer_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tracer_test.go b/tracer_test.go index 8d13109..49453ae 100644 --- a/tracer_test.go +++ b/tracer_test.go @@ -72,14 +72,14 @@ func TestTraceProxy(t *testing.T) { timeComponent := `\(\d+(?:\.\d+)?[^\)]+\)` expected := []*regexp.Regexp{ // Fake time component with (\d+\.\d+[^\)]+) - regexp.MustCompile(`tracer_test.go:27: Open 0x[0-9a-f]+ ` + timeComponent), - regexp.MustCompile(`tracer_test.go:27: Exec 0x[0-9a-f]+: CREATE TABLE t1 \(id INTEGER PRIMARY KEY\); args = \[\] ` + timeComponent), - regexp.MustCompile(`tracer_test.go:34: Begin 0x[0-9a-f]+ ` + timeComponent), - regexp.MustCompile(`tracer_test.go:39: Exec 0x[0-9a-f]+: INSERT INTO t1 \(id\) VALUES\(\?\); args = \[1\] ` + timeComponent), - regexp.MustCompile(`tracer_test.go:42: Query 0x[0-9a-f]+: SELECT id FROM t1 WHERE id = \?; args = \[1\] ` + timeComponent), - regexp.MustCompile(`tracer_test.go:49: Commit 0x[0-9a-f]+ ` + timeComponent), - regexp.MustCompile(`tracer_test.go:57: Begin 0x[0-9a-f]+ ` + timeComponent), - regexp.MustCompile(`tracer_test.go:61: Rollback 0x[0-9a-f]+ ` + timeComponent), + regexp.MustCompile(`tracer_test.go:28: Open 0x[0-9a-f]+ ` + timeComponent), + regexp.MustCompile(`tracer_test.go:28: Exec 0x[0-9a-f]+: CREATE TABLE t1 \(id INTEGER PRIMARY KEY\); args = \[\] ` + timeComponent), + regexp.MustCompile(`tracer_test.go:35: Begin 0x[0-9a-f]+ ` + timeComponent), + regexp.MustCompile(`tracer_test.go:40: Exec 0x[0-9a-f]+: INSERT INTO t1 \(id\) VALUES\(\?\); args = \[1\] ` + timeComponent), + regexp.MustCompile(`tracer_test.go:43: Query 0x[0-9a-f]+: SELECT id FROM t1 WHERE id = \?; args = \[1\] ` + timeComponent), + regexp.MustCompile(`tracer_test.go:50: Commit 0x[0-9a-f]+ ` + timeComponent), + regexp.MustCompile(`tracer_test.go:58: Begin 0x[0-9a-f]+ ` + timeComponent), + regexp.MustCompile(`tracer_test.go:62: Rollback 0x[0-9a-f]+ ` + timeComponent), regexp.MustCompile(`.*:\d+: Close 0x[0-9a-f]+ ` + timeComponent), }