Merge pull request #4 from dAppCore/dev

go update
This commit is contained in:
Snider 2026-03-20 21:06:05 +00:00 committed by GitHub
commit dcf677309d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 41 additions and 40 deletions

View file

@ -32,7 +32,6 @@ type App struct {
Runtime any
}
// Find locates a program on PATH and returns a Result containing the App.
//
// r := core.Find("node", "Node.js")

View file

@ -14,8 +14,8 @@ type ConfigVar[T any] struct {
set bool
}
func (v *ConfigVar[T]) Get() T { return v.val }
func (v *ConfigVar[T]) Set(val T) { v.val = val; v.set = true }
func (v *ConfigVar[T]) Get() T { return v.val }
func (v *ConfigVar[T]) Set(val T) { v.val = val; v.set = true }
func (v *ConfigVar[T]) IsSet() bool { return v.set }
func (v *ConfigVar[T]) Unset() {
v.set = false

View file

@ -224,7 +224,7 @@ func GeneratePack(pkg ScannedPackage) Result {
return Result{b.String(), true}
}
b.WriteString("import \"dappco.re/go/core/pkg/core\"\n\n")
b.WriteString("import \"dappco.re/go/core\"\n\n")
b.WriteString("func init() {\n")
// Pack groups (entire directories)

View file

@ -16,7 +16,7 @@ var (
// Lock is the DTO for a named mutex.
type Lock struct {
Name string
Name string
Mutex *sync.RWMutex
}

View file

@ -17,11 +17,11 @@ package core
// Service is a managed component with optional lifecycle.
type Service struct {
Name string
Options Options
OnStart func() Result
OnStop func() Result
OnReload func() Result
Name string
Options Options
OnStart func() Result
OnStop func() Result
OnReload func() Result
}
// serviceRegistry holds registered services.

View file

@ -13,9 +13,9 @@ import (
// TaskState holds background task state.
type TaskState struct {
Identifier string
Task Task
Result any
Error error
Task Task
Result any
Error error
}
// PerformAsync dispatches a task in a background goroutine.

View file

View file

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -5,7 +5,7 @@ import (
"io"
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -7,7 +7,7 @@ import (
"os"
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)
@ -144,7 +144,7 @@ func TestGeneratePack_WithFiles_Good(t *testing.T) {
os.MkdirAll(assetDir, 0755)
os.WriteFile(assetDir+"/hello.txt", []byte("hello world"), 0644)
source := "package test\nimport \"dappco.re/go/core/pkg/core\"\nfunc example() {\n\t_, _ = core.GetAsset(\"mygroup\", \"hello.txt\")\n}\n"
source := "package test\nimport \"dappco.re/go/core\"\nfunc example() {\n\t_, _ = core.GetAsset(\"mygroup\", \"hello.txt\")\n}\n"
goFile := dir + "/test.go"
os.WriteFile(goFile, []byte(source), 0644)

View file

@ -4,7 +4,7 @@ import (
"errors"
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -7,7 +7,7 @@ import (
"path/filepath"
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)
@ -74,10 +74,12 @@ type mockTranslator struct {
lang string
}
func (m *mockTranslator) Translate(id string, args ...any) Result { return Result{"translated:" + id, true} }
func (m *mockTranslator) SetLanguage(lang string) error { m.lang = lang; return nil }
func (m *mockTranslator) Language() string { return m.lang }
func (m *mockTranslator) AvailableLanguages() []string { return []string{"en", "de", "fr"} }
func (m *mockTranslator) Translate(id string, args ...any) Result {
return Result{"translated:" + id, true}
}
func (m *mockTranslator) SetLanguage(lang string) error { m.lang = lang; return nil }
func (m *mockTranslator) Language() string { return m.lang }
func (m *mockTranslator) AvailableLanguages() []string { return []string{"en", "de", "fr"} }
func TestI18n_WithTranslator_Good(t *testing.T) {
c := New()

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -4,7 +4,7 @@ import (
"os"
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -4,7 +4,7 @@ import (
"context"
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -3,7 +3,7 @@ package core_test
import (
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -5,7 +5,7 @@ import (
"testing"
"time"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)

View file

@ -1,6 +1,6 @@
package scantest
import "dappco.re/go/core/pkg/core"
import "dappco.re/go/core"
func example() {
_, _ = core.GetAsset("mygroup", "myfile.txt")

View file

@ -4,7 +4,7 @@ import (
"errors"
"testing"
. "dappco.re/go/core/pkg/core"
. "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)