2025-06-26 10:20:16 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
entries, err := os.ReadDir("../")
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
if len(entries) == 0 {
|
|
|
|
|
panic("No files found")
|
|
|
|
|
}
|
2025-08-26 17:15:43 +08:00
|
|
|
var check int
|
2025-06-26 10:20:16 +08:00
|
|
|
for _, e := range entries {
|
|
|
|
|
fmt.Printf("%s isDir[%t]\n", e.Name(), e.IsDir())
|
2025-08-26 17:15:43 +08:00
|
|
|
if !e.IsDir() {
|
|
|
|
|
switch e.Name() {
|
|
|
|
|
case "go.sum", "go.mod":
|
|
|
|
|
check++
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if check != 2 {
|
|
|
|
|
panic("Bad readdir entries go.mod/go.sum")
|
2025-06-26 10:20:16 +08:00
|
|
|
}
|
|
|
|
|
}
|