Skip to content

Commit

Permalink
Remove go workspace
Browse files Browse the repository at this point in the history
Removes the go.work and go.work.sum files from the repository.
Updates the Makefile to not use go workspaces.
Updates the vendored staticcheck so it won't fail on new style range
statements.
Makes minor fixes flagged by staticcheck
Adds instructions for setting up a Go workspace in HACKING doc
  • Loading branch information
csrwng committed Aug 26, 2024
1 parent c9f8a0c commit d7e15e0
Show file tree
Hide file tree
Showing 505 changed files with 49,841 additions and 43,385 deletions.
28 changes: 28 additions & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,31 @@ Then update the associated CRD files:
```shell
$ make api
```

### How to use go workspaces

Create a directory that will be the parent of the hypershift
code repository:

```shell
$ mkdir hypershift_ws
```

Under that directory, either move an existing hypershift repository or just clone hypershift again

```shell
$ cd hypershift_ws
$ git clone git@github.com:openshift/hypershift
```

Initialize the go workspace
```shell
go work init
go work use ./hypershift
go work use ./hypershift/api
go work sync
go work vendor
```

Now when running vscode, open the workspace directory to work
with hypershift code.
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GENAPIDOCS := $(abspath $(TOOLS_BIN_DIR)/gen-crd-api-reference-docs)
PROMTOOL=$(abspath $(TOOLS_BIN_DIR)/promtool)

GO_GCFLAGS ?= -gcflags=all='-N -l'
GO=GO111MODULE=on GOFLAGS=-mod=vendor go
GO=GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go
GO_BUILD_RECIPE=CGO_ENABLED=1 $(GO) build $(GO_GCFLAGS)
GO_E2E_RECIPE=CGO_ENABLED=1 $(GO) test $(GO_GCFLAGS) -tags e2e -c

Expand Down Expand Up @@ -47,12 +47,8 @@ pre-commit: all verify test

build: hypershift-operator control-plane-operator control-plane-pki-operator hypershift product-cli

.PHONY: sync
sync:
$(GO) work sync

.PHONY: update
update: sync api-deps api api-docs deps clients
update: api-deps api api-docs deps clients

.PHONY: verify
verify: update staticcheck fmt vet
Expand Down Expand Up @@ -205,16 +201,16 @@ vet:
.PHONY: deps
deps:
$(GO) mod tidy
$(GO) work vendor
$(GO) mod vendor
$(GO) mod verify
$(GO) list -m -mod=readonly -json all > /dev/null
(cd hack/tools && $(GO) mod tidy && $(GO) work vendor && $(GO) mod verify && $(GO) list -m -mod=readonly -json all > /dev/null)
(cd hack/tools && $(GO) mod tidy && $(GO) mod vendor && $(GO) mod verify && $(GO) list -m -mod=readonly -json all > /dev/null)

.PHONY: api-deps
api-deps:
cd api && \
$(GO) mod tidy && \
$(GO) work vendor && \
$(GO) mod vendor && \
$(GO) mod verify && \
$(GO) list -m -mod=readonly -json all > /dev/null

Expand Down
1 change: 1 addition & 0 deletions api/vendor/github.com/go-logr/logr/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Loading

0 comments on commit d7e15e0

Please sign in to comment.