diff --git a/pkg/deps/deps_test.go b/pkg/deps/deps_test.go index 0e29b8f5..97fb8d54 100644 --- a/pkg/deps/deps_test.go +++ b/pkg/deps/deps_test.go @@ -124,7 +124,7 @@ func TestWithDetection_NonFileType(t *testing.T) { h := opt(func(_ context.Context, hh []heartbeat.Heartbeat) ([]heartbeat.Result, error) { assert.Equal(t, []heartbeat.Heartbeat{ { - Entity: "testdata/codefiles/golang.go", + Entity: "testdata/golang.go", EntityType: heartbeat.AppType, }, }, hh) @@ -137,7 +137,7 @@ func TestWithDetection_NonFileType(t *testing.T) { }) result, err := h(context.Background(), []heartbeat.Heartbeat{{ - Entity: "testdata/codefiles/golang.go", + Entity: "testdata/golang.go", EntityType: heartbeat.AppType, }}) require.NoError(t, err) diff --git a/pkg/language/testdata/codefiles/golang.go b/pkg/language/testdata/codefiles/golang.go new file mode 100644 index 00000000..a6026025 --- /dev/null +++ b/pkg/language/testdata/codefiles/golang.go @@ -0,0 +1,24 @@ +package main + +// list every possible way of importing to try and break dependency detection +// http://learngowith.me/alternate-ways-of-importing-packages/ + +import "fmt" +import "compress/gzip" +import "github.com/golang/example/stringutil" +import ( + "log" + "os" +) +import newname "oldname" +import . "direct" +import _ "suppress" +import ( + "foobar" + _ "image/gif" + . "math" +) + +func main() { + fmt.Println("Hello, World!") +}