diff --git a/go.mod b/go.mod index 73da520e..630bd5db 100644 --- a/go.mod +++ b/go.mod @@ -179,16 +179,16 @@ replace ( // sync-replace-start replace ( - peridot.resf.org/apollo/pb => ./bazel-bin/apollo/proto/v1/apollopb_go_proto_/peridot.resf.org/apollo/pb bazel.build/protobuf => ./bazel-bin/build/bazel/protobuf/bazelbuild_go_proto_/bazel.build/protobuf bazel.build/remote/execution/v2 => ./bazel-bin/build/bazel/remote/execution/v2/remoteexecution_go_proto_/bazel.build/remote/execution/v2 bazel.build/semver => ./bazel-bin/build/bazel/semver/semver_go_proto_/bazel.build/semver + github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options => ./bazel-bin/protoc-gen-openapiv2/options/options_go_proto_/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options + peridot.resf.org/apollo/pb => ./bazel-bin/apollo/proto/v1/apollopb_go_proto_/peridot.resf.org/apollo/pb + peridot.resf.org/common => ./bazel-bin/proto/commonpb_go_proto_/peridot.resf.org/common peridot.resf.org/obsidian/pb => ./bazel-bin/obsidian/proto/v1/obsidianpb_go_proto_/peridot.resf.org/obsidian/pb - peridot.resf.org/peridot/pb => ./bazel-bin/peridot/proto/v1/peridotpb_go_proto_/peridot.resf.org/peridot/pb peridot.resf.org/peridot/admin/pb => ./bazel-bin/peridot/proto/v1/admin/adminpb_go_proto_/peridot.resf.org/peridot/admin/pb peridot.resf.org/peridot/keykeeper/pb => ./bazel-bin/peridot/proto/v1/keykeeper/keykeeperpb_go_proto_/peridot.resf.org/peridot/keykeeper/pb + peridot.resf.org/peridot/pb => ./bazel-bin/peridot/proto/v1/peridotpb_go_proto_/peridot.resf.org/peridot/pb peridot.resf.org/peridot/yumrepofs/pb => ./bazel-bin/peridot/proto/v1/yumrepofs/yumrepofspb_go_proto_/peridot.resf.org/peridot/yumrepofs/pb - peridot.resf.org/common => ./bazel-bin/proto/commonpb_go_proto_/peridot.resf.org/common - github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options => ./bazel-bin/protoc-gen-openapiv2/options/options_go_proto_/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options ) // sync-replace-end diff --git a/nofussvendor/main.go b/nofussvendor/main.go index db08e9ab..f8599964 100644 --- a/nofussvendor/main.go +++ b/nofussvendor/main.go @@ -31,16 +31,17 @@ package main import ( - bazelbuild "bazel.build/protobuf" "bytes" "fmt" - "github.com/sirupsen/logrus" - "google.golang.org/protobuf/proto" - "io/ioutil" "os" "os/exec" "path/filepath" + "sort" "strings" + + bazelbuild "bazel.build/protobuf" + "github.com/sirupsen/logrus" + "google.golang.org/protobuf/proto" ) func callBazel(args ...string) []byte { @@ -78,7 +79,7 @@ func main() { logrus.Fatal(err) } - goModContent, err := ioutil.ReadFile("go.mod") + goModContent, err := os.ReadFile("go.mod") if err != nil { logrus.Fatalf("could not read go.mod: %v", err) } @@ -120,7 +121,7 @@ func main() { } modContent := []byte(fmt.Sprintf("module %s", importpath)) - if err := ioutil.WriteFile(filepath.Join(modDir, "go.mod"), modContent, 0644); err != nil { + if err := os.WriteFile(filepath.Join(modDir, "go.mod"), modContent, 0644); err != nil { logrus.Fatalf("could not write go.mod file: %v", err) } @@ -130,7 +131,7 @@ func main() { }*/ /*dummyContent := []byte("// this file is generated for mock purposes. do not check in please\npackage dummy") - if err := ioutil.WriteFile(filepath.Join(dummyDir, "dummy.go"), dummyContent, 0644); err != nil { + if err := os.WriteFile(filepath.Join(dummyDir, "dummy.go"), dummyContent, 0644); err != nil { logrus.Fatalf("could not write dummy.go file: %v", err) }*/ @@ -147,6 +148,7 @@ func main() { for _, line := range strings.Split(stringGoMod, "\n") { trimmedLine := strings.TrimSpace(line) if trimmedLine == "// sync-replace-end" { + sort.Strings(replaceList) newContent = append(newContent, strings.Join(replaceList, "\n")) newContent = append(newContent, ")") inSyncReplaceStart = false @@ -160,7 +162,7 @@ func main() { } } - if err := ioutil.WriteFile(filepath.Join(searchDirectory, "go.mod"), []byte(strings.Join(newContent, "\n")), 0644); err != nil { + if err := os.WriteFile(filepath.Join(searchDirectory, "go.mod"), []byte(strings.Join(newContent, "\n")), 0644); err != nil { logrus.Fatalf("could not write end file go.mod: %v", err) }