rancher / wrangler-sample

Sample controller using wrangler
Apache License 2.0
13 stars 11 forks source link

old stuff left behind #1

Open brandonkal opened 4 years ago

brandonkal commented 4 years ago

This one is very puzzling.

  1. Starting with a local clone of this sample repo, I updated deps:
    
    module github.com/brandonkal/secret-replicator

go 1.14

require ( github.com/rancher/wrangler v0.4.0 github.com/rancher/wrangler-api v0.4.0 github.com/sirupsen/logrus v1.4.2 k8s.io/api v0.17.0 k8s.io/apimachinery v0.17.0 k8s.io/client-go v0.17.0 )

2. I updated import paths for the above module name.
3. make run
It runs fine and functions.

Now I run `go run pkg/codegen/cleanup/main.go` to remove the generated files and search and replace to rename Foo to something else, in my case SecretExport.
Running a `go build` again, I find it odd that there are generated files for foo. I've triple-checked that there are no references to this original and that the string "foo" is nowhere in the non-generated files.

I then rename `samplecontroller.k8s.io` to something else and update the code to use the appropriate references. A fresh `go build` results in a structure where there are still generated `samplecontroller.k8s.io` folders.

The output from the last build
<details>

```sh
brandon@dev:~/secret-replicator$ go generate
go: finding module for package github.com/brandonkal/secret-replicator/pkg/generated/clientset/versioned/typed/k8s.kite.run/v1alpha1
go: finding module for package github.com/brandonkal/secret-replicator/pkg/generated/informers/externalversions/k8s.kite.run
go: finding module for package github.com/brandonkal/secret-replicator/pkg/generated/controllers/k8s.kite.run/v1alpha1
./pkg/apis
pkg/apis/k8s.kite.run
pkg/apis/k8s.kite.run/v1alpha1
pkg/apis/k8s.kite.run/v1alpha1/doc.go
pkg/apis/k8s.kite.run/v1alpha1/types.go
pkg/apis/k8s.kite.run/v1alpha1/zz_generated_deepcopy.go
Removing pkg/apis/k8s.kite.run/v1alpha1/zz_generated_deepcopy.go
pkg/apis/k8s.kite.run/v1alpha1/zz_generated_list_types.go
Removing pkg/apis/k8s.kite.run/v1alpha1/zz_generated_list_types.go
pkg/apis/k8s.kite.run/v1alpha1/zz_generated_register.go
Removing pkg/apis/k8s.kite.run/v1alpha1/zz_generated_register.go
pkg/apis/k8s.kite.run/zz_generated_register.go
Removing pkg/apis/k8s.kite.run/zz_generated_register.go

brandonkal commented 4 years ago

I found that if I rm -rf ~/go/src/github.com/brandonkal/secret-replicator before a build, the old stuff doesn't get placed in the generated output. I'm not sure why this happens as I am developing outside my $GOPATH (which is ~/go)