简体   繁体   中英

Bazel : How to set this item of BUILD.bazel file?

What does this mean in Bazel 's documentation :

Add the code below to the BUILD or BUILD.bazel file in the root directory of your repository. Replace the string after prefix with the prefix you chose for your project earlier.

 load("@bazel_gazelle//:def.bzl", "gazelle") # gazelle:prefix github.com/example/project gazelle(name = "gazelle") 

There is a sentence "Replace the string after prefix with the prefix you chose for your project earlier", my project is D:\\workspace\\www\\go_work\\src\\golang_learning ,how to set it?

The wording implies you chose a prefix earlier; it looks like the documentation could use a bit of improvement, especially for those new to go - I don't see anything above that explaining the prefix they're talking about.

One way to think of this prefix is "the part of the path remaining when you strip off $GOPATH/src/ ". Based on the path you provide, this should be golang_learning , so change the gazelle:prefix line to

# gazelle:prefix golang_learning

and you should be good to go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM