mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-29 05:16:30 -04:00
unix: merge duplicate code in zerrors_linux_*.go
Run mkmerge.go on zerrors_linux_*.go to merge duplicate consts, funcs, and types into zerrors_linux.go Please see https://gist.github.com/jupj/639b5cda305d251161fec2304c27c9b9 for a script to validate these changes. Updates golang/go#33059 Change-Id: I168b5efc7fd6d2fcf7fc8dfe1ef5eea07f07f9c2 Reviewed-on: https://go-review.googlesource.com/c/sys/+/221318 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Ian Lance Taylor
parent
6b2465a022
commit
c5d0d7b4ec
@@ -187,6 +187,13 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("----- GENERATING: merging generated files -----\n")
|
||||
if err := mergeFiles(); err != nil {
|
||||
fmt.Printf("%v\n***** FAILURE: merging generated files *****\n\n", err)
|
||||
} else {
|
||||
fmt.Printf("----- SUCCESS: merging generated files -----\n\n")
|
||||
}
|
||||
|
||||
fmt.Printf("----- GENERATING ptrace pairs -----\n")
|
||||
ok := true
|
||||
for _, p := range ptracePairs {
|
||||
@@ -549,6 +556,25 @@ func (t *target) mksyscallFlags() (flags []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// Merge all the generated files for Linux targets
|
||||
func mergeFiles() error {
|
||||
// Setup environment variables
|
||||
os.Setenv("GOOS", runtime.GOOS)
|
||||
os.Setenv("GOARCH", runtime.GOARCH)
|
||||
|
||||
// Merge each of the four type of files
|
||||
for _, ztyp := range []string{"zerrors"} {
|
||||
cmd := makeCommand("go", "run", "mkmerge.go", "-out", fmt.Sprintf("%s_%s.go", ztyp, GOOS), fmt.Sprintf("%s_%s_*.go", ztyp, GOOS))
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not merge %s files: %w", ztyp, err)
|
||||
}
|
||||
fmt.Printf("%s files merged\n", ztyp)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// generatePtracePair takes a pair of GOARCH values that can run each
|
||||
// other's binaries, such as 386 and amd64. It extracts the PtraceRegs
|
||||
// type for each one. It writes a new file defining the types
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+462
-2897
File diff suppressed because it is too large
Load Diff
+462
-2897
File diff suppressed because it is too large
Load Diff
+468
-2903
File diff suppressed because it is too large
Load Diff
+455
-2890
File diff suppressed because it is too large
Load Diff
+464
-2899
File diff suppressed because it is too large
Load Diff
+464
-2899
File diff suppressed because it is too large
Load Diff
+464
-2899
File diff suppressed because it is too large
Load Diff
+464
-2899
File diff suppressed because it is too large
Load Diff
+524
-2959
File diff suppressed because it is too large
Load Diff
+524
-2959
File diff suppressed because it is too large
Load Diff
+449
-2884
File diff suppressed because it is too large
Load Diff
+522
-2957
File diff suppressed because it is too large
Load Diff
+513
-2948
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user