Support .proto files
This commit is contained in:
parent
48d46ea578
commit
5c8dd14d7e
1 changed files with 25 additions and 0 deletions
|
@ -1,8 +1,11 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/fs"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
|
@ -84,6 +87,28 @@ func listPrivateFiles(rootPackage string) []string {
|
|||
}
|
||||
}
|
||||
|
||||
if err := filepath.WalkDir(rootPackage, func(path string, d fs.DirEntry, err error) error {
|
||||
if strings.HasSuffix(path, ".proto") {
|
||||
content, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if bytes.Contains(content, []byte("//go:build solution")) {
|
||||
absPath, err := filepath.Abs(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
files = append(files, absPath)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}); err != nil {
|
||||
log.Fatalf("filewalk failed: %v", err)
|
||||
}
|
||||
|
||||
sort.Strings(files)
|
||||
return files
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue