Simplify contributor setup by removing GOPATH dependency

Updates the contributor guide to reflect the shift to Go Modules
as the default build system from Go 1.13 onwards. Contributors
are no longer required to clone the repository within their GOPATH,
simplifying the setup process.
This commit is contained in:
yongruilin 2024-10-03 16:54:48 -07:00
parent c05216bf79
commit ef223c911e
1 changed files with 3 additions and 12 deletions

View File

@ -17,23 +17,14 @@ description: |
## 2. Clone fork to local storage
Per Go's [workspace instructions][go-workspace], place Kubernetes' code on your
`GOPATH` using the following cloning procedure.
In your shell, define a local working directory as `working_dir`.
[go-workspace]: https://golang.org/doc/code.html#Workspaces
In your shell, define a local working directory as `working_dir`. If your `GOPATH` has multiple paths, pick
just one and use it instead of `$GOPATH`. You must follow exactly this pattern,
neither `$GOPATH/src/github.com/${your github profile name}/`
nor any other pattern will work.
[GO Modules]: https://go.dev/blog/using-go-modules
```sh
export working_dir="$(go env GOPATH)/src/k8s.io"
export working_dir="${HOME}/src/k8s.io" # Change to your preferred location for source code
```
If you already do Go development on github, the `k8s.io` directory
will be a sibling to your existing `github.com` directory.
Set `user` to match your github profile name:
```sh