2026-03-25 18:39:36 +00:00
|
|
|
package core_test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
|
|
|
|
. "dappco.re/go/core"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func ExampleDrive_New() {
|
|
|
|
|
c := New()
|
|
|
|
|
c.Drive().New(NewOptions(
|
|
|
|
|
Option{Key: "name", Value: "forge"},
|
|
|
|
|
Option{Key: "transport", Value: "https://forge.lthn.ai"},
|
|
|
|
|
))
|
|
|
|
|
|
feat: eliminate fmt, string concat — add core.Println, use Concat/Path everywhere
New primitive: core.Println() wraps fmt.Println.
Replaced across all test + example files:
- fmt.Println → Println (17 example files)
- fmt.Sprintf → Concat + Sprint
- dir + "/file" → Path(dir, "file") (path security)
- "str" + var → Concat("str", var) (AX consistency)
"fmt" import is now zero across all test files.
String concat with + is zero across all test files.
Remaining 9 stdlib imports (all Go infrastructure):
testing, context, time, sync, embed, io/fs, bytes, gzip, base64
558 tests, 84.5% coverage.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-25 19:42:39 +00:00
|
|
|
Println(c.Drive().Has("forge"))
|
|
|
|
|
Println(c.Drive().Names())
|
2026-03-25 18:39:36 +00:00
|
|
|
// Output:
|
|
|
|
|
// true
|
|
|
|
|
// [forge]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleDrive_Get() {
|
|
|
|
|
c := New()
|
|
|
|
|
c.Drive().New(NewOptions(
|
|
|
|
|
Option{Key: "name", Value: "charon"},
|
|
|
|
|
Option{Key: "transport", Value: "http://10.69.69.165:9101"},
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
r := c.Drive().Get("charon")
|
|
|
|
|
if r.OK {
|
|
|
|
|
h := r.Value.(*DriveHandle)
|
feat: eliminate fmt, string concat — add core.Println, use Concat/Path everywhere
New primitive: core.Println() wraps fmt.Println.
Replaced across all test + example files:
- fmt.Println → Println (17 example files)
- fmt.Sprintf → Concat + Sprint
- dir + "/file" → Path(dir, "file") (path security)
- "str" + var → Concat("str", var) (AX consistency)
"fmt" import is now zero across all test files.
String concat with + is zero across all test files.
Remaining 9 stdlib imports (all Go infrastructure):
testing, context, time, sync, embed, io/fs, bytes, gzip, base64
558 tests, 84.5% coverage.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-25 19:42:39 +00:00
|
|
|
Println(h.Transport)
|
2026-03-25 18:39:36 +00:00
|
|
|
}
|
|
|
|
|
// Output: http://10.69.69.165:9101
|
|
|
|
|
}
|