mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-11-27 07:26:26 +00:00
Sort sync-replace entries
- Sorts sync-replace entries alphabetically - More compatible with go mod tidy - Removes obsolete ioutil calls - sorts imports: prettier
This commit is contained in:
parent
d6a44d7f75
commit
9a08c3368e
8
go.mod
8
go.mod
@ -179,16 +179,16 @@ replace (
|
|||||||
|
|
||||||
// sync-replace-start
|
// sync-replace-start
|
||||||
replace (
|
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/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/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
|
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/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/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/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/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
|
// sync-replace-end
|
||||||
|
@ -31,16 +31,17 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
bazelbuild "bazel.build/protobuf"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
bazelbuild "bazel.build/protobuf"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func callBazel(args ...string) []byte {
|
func callBazel(args ...string) []byte {
|
||||||
@ -78,7 +79,7 @@ func main() {
|
|||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
goModContent, err := ioutil.ReadFile("go.mod")
|
goModContent, err := os.ReadFile("go.mod")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatalf("could not read go.mod: %v", err)
|
logrus.Fatalf("could not read go.mod: %v", err)
|
||||||
}
|
}
|
||||||
@ -120,7 +121,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
modContent := []byte(fmt.Sprintf("module %s", importpath))
|
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)
|
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")
|
/*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)
|
logrus.Fatalf("could not write dummy.go file: %v", err)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
@ -147,6 +148,7 @@ func main() {
|
|||||||
for _, line := range strings.Split(stringGoMod, "\n") {
|
for _, line := range strings.Split(stringGoMod, "\n") {
|
||||||
trimmedLine := strings.TrimSpace(line)
|
trimmedLine := strings.TrimSpace(line)
|
||||||
if trimmedLine == "// sync-replace-end" {
|
if trimmedLine == "// sync-replace-end" {
|
||||||
|
sort.Strings(replaceList)
|
||||||
newContent = append(newContent, strings.Join(replaceList, "\n"))
|
newContent = append(newContent, strings.Join(replaceList, "\n"))
|
||||||
newContent = append(newContent, ")")
|
newContent = append(newContent, ")")
|
||||||
inSyncReplaceStart = false
|
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)
|
logrus.Fatalf("could not write end file go.mod: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user