reorganize: consolidate demo directories
- Consolidate _demo, _pydemo, _embdemo into single _demo directory structure
- Organize demos by language: _demo/{go,py,c,embed}/
- Categorize demos based on imports:
- Python library demos (py imports) → _demo/py/
- C/C++ library demos (c/cpp imports) → _demo/c/
- Go-specific demos → _demo/go/
- Embedded demos → _demo/embed/
- Move C-related demos (asm*, cabi*, cgo*, linkname, targetsbuild) from go/ to c/
- Update all path references in README.md and GitHub workflows
- Improve demo organization and navigation as requested in #1256
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
29
_demo/go/readdir/main.go
Normal file
29
_demo/go/readdir/main.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
entries, err := os.ReadDir("../")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(entries) == 0 {
|
||||
panic("No files found")
|
||||
}
|
||||
var check int
|
||||
for _, e := range entries {
|
||||
fmt.Printf("%s isDir[%t]\n", e.Name(), e.IsDir())
|
||||
if !e.IsDir() {
|
||||
switch e.Name() {
|
||||
case "go.sum", "go.mod":
|
||||
check++
|
||||
}
|
||||
}
|
||||
}
|
||||
if check != 2 {
|
||||
panic("Bad readdir entries go.mod/go.sum")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user