mirror of
https://github.com/golang/sys.git
synced 2026-02-08 03:36:03 +03: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
|
||||
|
||||
2453
unix/zerrors_linux.go
Normal file
2453
unix/zerrors_linux.go
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user