diff --git a/unix/README.md b/unix/README.md index 474efad0..7d3c060e 100644 --- a/unix/README.md +++ b/unix/README.md @@ -149,7 +149,7 @@ To add a constant, add the header that includes it to the appropriate variable. Then, edit the regex (if necessary) to match the desired constant. Avoid making the regex too broad to avoid matching unintended constants. -### mkmerge.go +### internal/mkmerge This program is used to extract duplicate const, func, and type declarations from the generated architecture-specific files listed below, and merge these diff --git a/unix/mkmerge.go b/unix/internal/mkmerge/mkmerge.go similarity index 95% rename from unix/mkmerge.go rename to unix/internal/mkmerge/mkmerge.go index 9bfd150f..efcdede5 100644 --- a/unix/mkmerge.go +++ b/unix/internal/mkmerge/mkmerge.go @@ -2,25 +2,22 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build ignore -// +build ignore - -// mkmerge.go parses generated source files and merges common +// The mkmerge command parses generated source files and merges common // consts, funcs, and types into a common source file, per GOOS. // // Usage: -// $ go run mkmerge.go -out MERGED FILE [FILE ...] +// $ mkmerge -out MERGED FILE [FILE ...] // // Example: // # Remove all common consts, funcs, and types from zerrors_linux_*.go // # and write the common code into zerrors_linux.go -// $ go run mkmerge.go -out zerrors_linux.go zerrors_linux_*.go +// $ mkmerge -out zerrors_linux.go zerrors_linux_*.go // -// mkmerge.go performs the merge in the following steps: -// 1. Construct the set of common code that is idential in all -// architecture-specific files. -// 2. Write this common code to the merged file. -// 3. Remove the common code from all architecture-specific files. +// mkmerge performs the merge in the following steps: +// 1. Construct the set of common code that is idential in all +// architecture-specific files. +// 2. Write this common code to the merged file. +// 3. Remove the common code from all architecture-specific files. package main import ( @@ -464,7 +461,7 @@ func merge(mergedFile string, archFiles ...string) error { } buf := bufio.NewWriter(f) - fmt.Fprintln(buf, "// Code generated by mkmerge.go; DO NOT EDIT.") + fmt.Fprintln(buf, "// Code generated by mkmerge; DO NOT EDIT.") fmt.Fprintln(buf) fmt.Fprintf(buf, "//go:build %s\n", goos) fmt.Fprintf(buf, "// +build %s\n", goos) diff --git a/unix/mkmerge_test.go b/unix/internal/mkmerge/mkmerge_test.go similarity index 98% rename from unix/mkmerge_test.go rename to unix/internal/mkmerge/mkmerge_test.go index a1463b97..32072441 100644 --- a/unix/mkmerge_test.go +++ b/unix/internal/mkmerge/mkmerge_test.go @@ -2,12 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build ignore -// +build ignore - -// Test cases for mkmerge.go. -// Usage: -// $ go test mkmerge.go mkmerge_test.go package main import ( diff --git a/unix/linux/mkall.go b/unix/linux/mkall.go index 70a58d3c..7ea4de8d 100644 --- a/unix/linux/mkall.go +++ b/unix/linux/mkall.go @@ -572,7 +572,7 @@ func mergeFiles() error { // Merge each of the four type of files for _, ztyp := range []string{"zerrors", "zsyscall", "zsysnum", "ztypes"} { - cmd := makeCommand("go", "run", "mkmerge.go", "-out", fmt.Sprintf("%s_%s.go", ztyp, GOOS), fmt.Sprintf("%s_%s_*.go", ztyp, GOOS)) + cmd := makeCommand("go", "run", "./internal/mkmerge", "-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) diff --git a/unix/zerrors_linux.go b/unix/zerrors_linux.go index 3bbc5275..4e4e7f82 100644 --- a/unix/zerrors_linux.go +++ b/unix/zerrors_linux.go @@ -1,4 +1,4 @@ -// Code generated by mkmerge.go; DO NOT EDIT. +// Code generated by mkmerge; DO NOT EDIT. //go:build linux // +build linux diff --git a/unix/zsyscall_linux.go b/unix/zsyscall_linux.go index 4f5da1f5..fe6c232c 100644 --- a/unix/zsyscall_linux.go +++ b/unix/zsyscall_linux.go @@ -1,4 +1,4 @@ -// Code generated by mkmerge.go; DO NOT EDIT. +// Code generated by mkmerge; DO NOT EDIT. //go:build linux // +build linux diff --git a/unix/ztypes_linux.go b/unix/ztypes_linux.go index 620a6702..d887d9b5 100644 --- a/unix/ztypes_linux.go +++ b/unix/ztypes_linux.go @@ -1,4 +1,4 @@ -// Code generated by mkmerge.go; DO NOT EDIT. +// Code generated by mkmerge; DO NOT EDIT. //go:build linux // +build linux