Commit Graph

121791 Commits

Author SHA1 Message Date
Tim Hockin
6420e64662
Move go-header-file flag to each tool
Also remove the build-tag flag (unused, untested).

This changes some output comments (less redundant).
2024-02-29 22:07:17 -08:00
Tim Hockin
3a77592b2c
Remove gengo verify-only - unused and untested
All of our own tools emit into a tmp tree and then diff that.
2024-02-29 22:07:17 -08:00
Tim Hockin
d0dd72b01e
Move OutputFileBase flag to each tool 2024-02-29 22:07:16 -08:00
Tim Hockin
26a1a13b80
Rename output-package -> output-pkg
To parallel "output-dir".
2024-02-29 22:07:15 -08:00
Tim Hockin
6a375b8f4c
Move the OutputBase flag to each tool
...and rename to --output-dir
2024-02-29 22:07:14 -08:00
Tim Hockin
875566f997
Type-assert gengo CustomArgs blindly
If it does fail, it is catastophic.  Don't bother trying to handle it.
2024-02-29 22:07:13 -08:00
Tim Hockin
0ff7dd1943
Rename gengo DefaultGen -> GolangGenerator 2024-02-29 22:07:12 -08:00
Tim Hockin
2ac119bea9
Rename gengo Target.SourcePath() -> Dir() 2024-02-29 22:07:11 -08:00
Tim Hockin
fcd6c19c24
Rename gengo generator.Package -> Target 2024-02-29 22:07:10 -08:00
Tim Hockin
d2c7401910
Drop generator.Packages type 2024-02-29 22:07:10 -08:00
Tim Hockin
b2832697d5
Rename DefaultPackage to SimplePackage 2024-02-29 22:07:09 -08:00
Tim Hockin
bd31265d23
Make update-vendor log the go env 2024-02-29 22:07:08 -08:00
Tim Hockin
4627a15ac0
Get rid of vendor baggage in go-to-proto 2024-02-29 22:07:07 -08:00
Tim Hockin
4320631265
codegen: Don't need to pass --logtostderr
All the tools already set it internally
2024-02-29 22:07:06 -08:00
Tim Hockin
2c0da11c0a
Make verify-shellcheck take optional args 2024-02-29 22:07:05 -08:00
Tim Hockin
19b37f046f
Rename update-generated-* dockerized
Now they don't start with "update" and confuse dumb scripts which try to
run all the updates.
2024-02-29 22:07:04 -08:00
Tim Hockin
94b709c0e2
codegen: Use single-dash for '-v' 2024-02-29 22:07:04 -08:00
Tim Hockin
dd4e456875
codegen:proto: Use revised API to gengo parser 2024-02-29 22:07:03 -08:00
Tim Hockin
4b55936ab0
Remove defunct trim-path-prefix 2024-02-29 22:07:02 -08:00
Tim Hockin
2348e94908
Conversion: Better logging 2024-02-29 22:07:01 -08:00
Tim Hockin
6dbc754ed6
Retool typecheck to be simpler
Instead of walking paths ourselves, just let Go's packages library do
it.  This is a slight CLI change - it wants "./foo" rather than "foo".

This also flagged a few things which seem to be legit failures.
2024-02-29 22:07:00 -08:00
Tim Hockin
4d37426a3a
Update Makefile comments 2024-02-29 22:06:59 -08:00
Tim Hockin
965341390f
Remove KUBE_GO_PACKAGE
Almost nobody should need it, and if you do, it should be an immediate
smell.
2024-02-29 22:06:58 -08:00
Tim Hockin
5a96a56c80
Fix make test-integration for workspaces 2024-02-29 22:06:57 -08:00
Tim Hockin
4b20f81c19
Fix verify-conformance-yaml for workspaces 2024-02-29 22:06:57 -08:00
Tim Hockin
d61f299614
Call verify_go_version at the END of setup_env
Prior to this it would download Go, setup the environment, then (maybe)
download Go again.

I renamed verify_go_version to be internal and fixed all callers.
2024-02-29 22:06:56 -08:00
Tim Hockin
e84adf611f
Remove references to "GO111MODULE" 2024-02-29 22:06:55 -08:00
Tim Hockin
2a1147a434
Call setup_env from verify-vendor 2024-02-29 22:06:54 -08:00
Tim Hockin
d2a4a1958f
Tidy update-vendor-licenses for workspaces 2024-02-29 22:06:53 -08:00
Tim Hockin
d772f7719d
Remove defunct references to "vendor" 2024-02-29 22:06:52 -08:00
Tim Hockin
7f5982e708
code-generator: Remove now unused helper function 2024-02-29 22:06:51 -08:00
Tim Hockin
10c32b3e2f
Get rid of most references to GOPATH 2024-02-29 22:06:51 -08:00
Tim Hockin
3c2940f2ae
Kill off PRJ_SRC_PATH 2024-02-29 22:06:50 -08:00
Tim Hockin
651297220e
Fix pin-dependency for workspaces 2024-02-29 22:06:49 -08:00
Tim Hockin
1c3e701e0c
Fix verify-spelling for workspaces 2024-02-29 22:06:48 -08:00
Tim Hockin
032dd890a5
Fix verify-external-dependencies-version for workspaces 2024-02-29 22:06:47 -08:00
Tim Hockin
bff2e92edd
Fix update-netparse-cve for workspaces 2024-02-29 22:06:46 -08:00
Tim Hockin
fad5bb1cdd
Fix lint-dependencies for workspaces 2024-02-29 22:06:45 -08:00
Tim Hockin
b2b9de88eb
Fix update-import-aliases for workspaces 2024-02-29 22:06:44 -08:00
Tim Hockin
530c4352fb
Rename new::setup_env back to setup_env 2024-02-29 22:06:44 -08:00
Tim Hockin
bece9bc3f4
Remove old::setup_env 2024-02-29 22:06:43 -08:00
Tim Hockin
f9ca58efe9
Remove run-in-gopath.sh 2024-02-29 22:06:42 -08:00
Tim Hockin
b32e207256
Fix last run-in-gopath user: typecheck
This now works across modules

Verified by introducing errors in 2 different modules and running.
2024-02-29 22:06:41 -08:00
Tim Hockin
91efe7e571
Fix import-boss wrt gengo/v2 2024-02-29 22:06:40 -08:00
Tim Hockin
c8b61bb98b
Fix register-gen wrt gengo/v2 2024-02-29 22:06:39 -08:00
Tim Hockin
f772410082
Make code-gen subprojects work on gengo/v2 2024-02-29 22:06:38 -08:00
Tim Hockin
251b22a7f8
Make update-codegen protobuf work on gengo/v2 2024-02-29 22:06:38 -08:00
Tim Hockin
b0a70dec4a
Fix go-to-protobuf wrt gengo/v2
There's some very fishy-smelling logic in here, but this commit is
trying to be as focused as possible.

The *.pb.go diffs are the "name" encoded in the descriptor.  The
descriptor blobs can be decoded by this program (thanks StackOverflow!):

```
package main

import (
	"bytes"
	"compress/gzip"
	"encoding/json"
	"fmt"
	"os"

	"io/ioutil"

	proto "github.com/golang/protobuf/proto"
	dpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
)

func main() {
	m := map[string][]byte{
		"before": blobv1,
		"after":  blobv2,
	}
	arg := os.Args[1]
	dump(m[arg])
}

func dump(bytes []byte) {
	fd, err := decodeFileDesc(bytes)
	if err != nil {
		panic(err)
	}
	b, err := json.MarshalIndent(fd, "", "  ")
	if err != nil {
		panic(err)
	}
	fmt.Println(string(b))
}

// decompress does gzip decompression.
func decompress(b []byte) ([]byte, error) {
	r, err := gzip.NewReader(bytes.NewReader(b))
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	out, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	return out, nil
}

func decodeFileDesc(enc []byte) (*dpb.FileDescriptorProto, error) {
	raw, err := decompress(enc)
	if err != nil {
		return nil, fmt.Errorf("failed to decompress enc: %v", err)
	}

	fd := new(dpb.FileDescriptorProto)
	if err := proto.Unmarshal(raw, fd); err != nil {
		return nil, fmt.Errorf("bad descriptor: %v", err)
	}
	return fd, nil
}

var blobv1 = []byte{
	// insert proto "before" blob here
}

var blobv2 = []byte{
	// insert proto "after" blob here
}
```

Running this with "before" and "after" args, and diffing the output
yields something like:

```diff
--- /tmp/a	2023-12-23 23:57:04.748090836 -0800
+++ /tmp/b	2023-12-23 23:57:11.000040973 -0800
@@ -1,5 +1,5 @@
 {
-  "name": "k8s.io/kubernetes/vendor/k8s.io/api/admission/v1/generated.proto",
+  "name": "k8s.io/api/admission/v1/generated.proto",
   "package": "k8s.io.api.admission.v1",
   "dependency": [
     "github.com/gogo/protobuf/gogoproto/gogo.proto",
```
2024-02-29 22:06:37 -08:00
Tim Hockin
7506048d3f
Make update-codegen client work on gengo/v2 2024-02-29 22:06:36 -08:00
Tim Hockin
b961b39efa
Fix client-gen wrt gengo/v2 2024-02-29 22:06:35 -08:00