Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using _osx.go suffix will evict the file from go_library srcs attribute when using darwin platform #1970

Open
Zenithar opened this issue Nov 5, 2024 · 2 comments

Comments

@Zenithar
Copy link

Zenithar commented Nov 5, 2024

What version of gazelle are you using?

0.39.1

What version of rules_go are you using?

v0.50.1

What version of Bazel are you using?

6.5.0

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

  • darwin
  • arm64

What did you do?

While using the awnumar/memcall, and more precisely the memcall_osx.go, it looks like running bazel run //:gazelle on a darwin/arm64 machine will generate a go_library without this file included.

I created a suffix_osx.go in the language/go/test data/platforms from the content of the suffix_darwin.go and executed tests; it looks like the file is ignored as the unmodified golden BUILD.want doesn't trigger a difference.

Alternatively, adding "osx": {"darwin"} into the OSAliases in

var OSAliases = map[string][]string{
looks to fix the issue, but has side effects I can't judge.

What did you expect to see?

go_library(
    name = "memcall",
    srcs = [
        "memcall.go",
        "memcall_freebsd.go",
        "memcall_openbsd.go",
        "memcall_unix.go",
+       "memcall_osx.go",
        "memcall_windows.go",
    ],

What did you see instead?

go_library(
    name = "memcall",
    srcs = [
        "memcall.go",
        "memcall_freebsd.go",
        "memcall_openbsd.go",
        "memcall_unix.go",
-       "memcall_osx.go",
        "memcall_windows.go",
    ],
@Zenithar Zenithar changed the title Using _osx suffix will evict the file from go_library srcs attribute Using _osx.go suffix will evict the file from go_library srcs attribute when using darwin platform Nov 5, 2024
@Zenithar
Copy link
Author

Zenithar commented Nov 5, 2024

I understand that _osx is not a valid GOOS, but the file has a valid go-build tag targeting darwin platform. So, the library works as expected with a native unmanaged Go toolchain, while a Bazel-managed tool ignores this file.

@Zenithar
Copy link
Author

Zenithar commented Nov 5, 2024

The PR - awnumar/memcall#14 - fixed the conventional naming issue from the library PoV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant