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
2 changes: 2 additions & 0 deletions cmd/greeter_en/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2021 Pants project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).
Comment on lines 1 to 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Total aside but: should we actually have these headers for files in the example repos?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be happy to get rid of them. @benjyw any reason you added them way back when?


go_package()

# This target allows us to use `./pants run` and `./pants package` on this `main` Go package.
#
# You can optionally set the field `output_path="greeter_en"`, for example, for the binary's name
Expand Down
2 changes: 2 additions & 0 deletions cmd/greeter_es/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2021 Pants project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

go_package()

# This target allows us to use `./pants run` and `./pants package` on this `main` Go package.
#
# You can optionally set the field `output_path="greeter_es"`, for example, for the binary's name
Expand Down
2 changes: 1 addition & 1 deletion pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

[GLOBAL]
pants_version = "2.8.0"
pants_version = "2.9.0.dev3"
backend_packages = ["pants.backend.experimental.go"]

[anonymous-telemetry]
Expand Down
7 changes: 7 additions & 0 deletions pkg/embed_example/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2021 Pants project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

go_package(dependencies=[":embeds", ":testdata"])

resources(name="embeds", sources=["hello.txt"])
files(name="testdata", sources=["testdata/*"])
1 change: 1 addition & 0 deletions pkg/embed_example/hello.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I'm an embedded resource!
9 changes: 9 additions & 0 deletions pkg/embed_example/lib.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2021 Pants project contributors.
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package embed_example

// TODO: enable after fixing Pants when lib code has embeds but tests don't.
// import _ "embed"
// //go:embed hello.txt
// var embeddedHello string
23 changes: 23 additions & 0 deletions pkg/embed_example/lib_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2021 Pants project contributors.
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package embed_example

import (
"os"
"testing"
)

// TODO: enable after fixing Pants when lib code has embeds but tests don't.
// func TestResourceEmbedding(t *testing.T) {
// if embeddedHello != "I'm an embedded resource!" {
// t.Fatalf("message mismatch: want=%s; got=%s", "I'm an embedded resource!", embeddedHello)
// }
// }

func TestTestDataFolder(t *testing.T) {
_, err := os.Stat("testdata/f.txt")
if err != nil {
t.Fatalf("Could not stat pkg/embed_example/testdata/f.txt: %v", err)
}
}
1 change: 1 addition & 0 deletions pkg/embed_example/testdata/f.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Some test data!
4 changes: 4 additions & 0 deletions pkg/greeter/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2021 Pants project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

go_package()
4 changes: 4 additions & 0 deletions pkg/uuid/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2021 Pants project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

go_package()