Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci-cli-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- reopened
- ready_for_review
paths:
- .github/workflows/ci-cli-build.yml
- cli/**

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-cli-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- reopened
- ready_for_review
paths:
- .github/workflows/ci-cli-lint.yml
- cli/**

permissions:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-go-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- reopened
- ready_for_review
paths:
- .github/workflows/ci-go-lint.yml
- "**/*.go"
- "**/go.mod"

Expand Down Expand Up @@ -57,4 +58,4 @@ jobs:
with:
working-directory: ${{ matrix.dir }}
version: latest
args: --timeout=10m
args: --timeout=10m --config=${{ github.workspace }}/.trunk/configs/.golangci.yaml
1 change: 1 addition & 0 deletions .github/workflows/ci-go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- reopened
- ready_for_review
paths:
- .github/workflows/ci-go-test.yml
- "**/*.go"
- "**/go.mod"
- "**/testdata/**"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-release-info-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- reopened
- ready_for_review
paths:
- .github/workflows/ci-release-info-build.yaml
- tools/release-info/**

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-release-info-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- reopened
- ready_for_review
paths:
- .github/workflows/ci-release-info-lint.yaml
- tools/release-info/**

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-runtime-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- reopened
- ready_for_review
paths:
- .github/workflows/ci-runtime-integration-tests.yml
- runtime/**

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-sdk-as-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- reopened
- ready_for_review
paths:
- .github/workflows/ci-sdk-as-build.yml
- sdk/assemblyscript/**

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-sdk-as-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- reopened
- ready_for_review
paths:
- .github/workflows/ci-sdk-as-lint.yml
- sdk/assemblyscript/**

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-sdk-as-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- reopened
- ready_for_review
paths:
- .github/workflows/ci-sdk-as-test.yml
- sdk/assemblyscript/**

permissions:
Expand Down
5 changes: 5 additions & 0 deletions .trunk/configs/.golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: "2"
linters:
exclusions:
presets:
- std-error-handling
16 changes: 8 additions & 8 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.22.10
version: 1.22.12

# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
Expand All @@ -22,23 +22,23 @@ runtimes:
lint:
enabled:
- taplo@0.9.3
- trivy@0.60.0
- renovate@39.190.1
- trivy@0.61.0
- renovate@39.230.2
- actionlint@1.7.7
- checkov@3.2.382
- checkov@3.2.396
- git-diff-check
- gofmt@1.20.4
- golangci-lint@1.64.6
- golangci-lint@1.64.8
- hadolint@2.12.1-beta
- markdownlint@0.44.0
- osv-scanner@1.9.2
- osv-scanner@2.0.0
- prettier@3.5.3:
packages:
- assemblyscript-prettier@3.0.1
- shellcheck@0.10.0
- shfmt@3.6.0
- trufflehog@3.88.15
- yamllint@1.35.1
- trufflehog@3.88.20
- yamllint@1.37.0
definitions:
- name: osv-scanner
commands:
Expand Down
2 changes: 1 addition & 1 deletion runtime/collections/vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func createIndexObject(searchMethod manifest.SearchMethodInfo, searchMethodName
vectorIndex.Type = sequential.SequentialVectorIndexType
vectorIndex.VectorIndex = sequential.NewSequentialVectorIndex(searchMethodName, searchMethod.Embedder)
default:
return nil, fmt.Errorf("Unknown index type: %s", searchMethod.Index.Type)
return nil, fmt.Errorf("unknown index type: %s", searchMethod.Index.Type)
}

return vectorIndex, nil
Expand Down
4 changes: 2 additions & 2 deletions runtime/graphql/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ func handleGraphQLRequest(w http.ResponseWriter, r *http.Request) {
logger.Warn(ctx).Msg(msg)
utils.WriteJsonContentHeader(w)
if ok, _ := gqlRequest.IsIntrospectionQuery(); ok {
_, _ = w.Write([]byte(`{"data":{"__schema":{"types":[]}}}`))
fmt.Fprint(w, `{"data":{"__schema":{"types":[]}}}`)
} else {
_, _ = w.Write([]byte(fmt.Sprintf(`{"errors":[{"message":"%s"}]}`, msg)))
fmt.Fprintf(w, `{"errors":[{"message":"%s"}]}`, msg)
}
return
}
Expand Down
6 changes: 3 additions & 3 deletions runtime/languages/assemblyscript/tests/special_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ func GetRuntimeTypeInfo(mod wasm.Module, md *metadata.Metadata) (string, error)
gbl := mod.ExportedGlobal("__rtti_base")
offset := uint32(gbl.Get())
sb.WriteString("\nRuntime type information:\n")
sb.WriteString(fmt.Sprintf("base: 0x%x\n", offset))
fmt.Fprintf(sb, "base: 0x%x\n", offset)

len, ok := mod.Memory().ReadUint32Le(offset)
offset += 4
if !ok {
return "", fmt.Errorf("failed to read length")
}
sb.WriteString(fmt.Sprintf("length: %v\n", len))
fmt.Fprintf(sb, "length: %v\n", len)

sb.WriteString("\n")

Expand All @@ -81,7 +81,7 @@ func GetRuntimeTypeInfo(mod wasm.Module, md *metadata.Metadata) (string, error)
}
}

sb.WriteString(fmt.Sprintf("%v: %s\n", i, typeName))
fmt.Fprintf(sb, "%v: %s\n", i, typeName)

f, ok := mod.Memory().ReadUint32Le(offset)
offset += 4
Expand Down
2 changes: 1 addition & 1 deletion runtime/middleware/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func Shutdown() {
func HandleJWT(next http.Handler) http.Handler {
var jwtParser = jwt.NewParser()
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var ctx context.Context = r.Context()
ctx := r.Context()
tokenStr := r.Header.Get("Authorization")
if tokenStr != "" {
if s, found := strings.CutPrefix(tokenStr, "Bearer "); found {
Expand Down
2 changes: 1 addition & 1 deletion runtime/models/hypermode.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func getHypermodeModelEndpointUrl(model *manifest.ModelInfo) (string, error) {
if _hypermodeModelHost == "" {
_hypermodeModelHost = os.Getenv("HYPERMODE_MODEL_HOST")
if _hypermodeModelHost == "" {
return "", fmt.Errorf("Hypermode hosted models are not available in this environment")
return "", fmt.Errorf("hypermode hosted models are not available in this environment")
}
}
endpoint := fmt.Sprintf("http://%s.%s/%[1]s:predict", strings.ToLower(model.Name), _hypermodeModelHost)
Expand Down
4 changes: 2 additions & 2 deletions sdk/go/examples/http/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func GetRandomQuote() (*Quote, error) {
return nil, err
}
if !response.Ok() {
return nil, fmt.Errorf("Failed to fetch quote. Received: %d %s", response.Status, response.StatusText)
return nil, fmt.Errorf("failed to fetch quote. Received: %d %s", response.Status, response.StatusText)
}

// The API returns an array of quotes, but we only want the first one.
Expand Down Expand Up @@ -119,7 +119,7 @@ func CreateGithubIssue(owner, repo, title, body string) (*Issue, error) {
return nil, err
}
if !response.Ok() {
return nil, fmt.Errorf("Failed to create issue. Received: %d %s", response.Status, response.StatusText)
return nil, fmt.Errorf("failed to create issue. Received: %d %s", response.Status, response.StatusText)
}

// The response will contain the issue data, including the URL of the issue on GitHub.
Expand Down
10 changes: 5 additions & 5 deletions sdk/go/examples/mysql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func AddPerson(name string, age int) (*Person, error) {

response, err := mysql.Execute(connection, query, name, age)
if err != nil {
return nil, fmt.Errorf("Failed to add person to database: %v", err)
return nil, fmt.Errorf("failed to add person to database: %v", err)
}

p := Person{Id: int(response.LastInsertId), Name: name, Age: age}
Expand All @@ -65,11 +65,11 @@ func UpdatePersonHome(id int, longitude, latitude float64) (*Person, error) {

response, err := mysql.Execute(connection, query, longitude, latitude, id)
if err != nil {
return nil, fmt.Errorf("Failed to update person in database: %v", err)
return nil, fmt.Errorf("failed to update person in database: %v", err)
}

if response.RowsAffected != 1 {
return nil, fmt.Errorf("Failed to update person with id %d. The record may not exist.", id)
return nil, fmt.Errorf("failed to update person with id %d - the record may not exist", id)
}

return GetPerson(id)
Expand All @@ -80,11 +80,11 @@ func DeletePerson(id int) (string, error) {

response, err := mysql.Execute(connection, query, id)
if err != nil {
return "", fmt.Errorf("Failed to delete person from database: %v", err)
return "", fmt.Errorf("failed to delete person from database: %v", err)
}

if response.RowsAffected != 1 {
return "", fmt.Errorf("Failed to delete person with id %d. The record may not exist.", id)
return "", fmt.Errorf("failed to delete person with id %d - the record may not exist", id)
}

return "success", nil
Expand Down
10 changes: 5 additions & 5 deletions sdk/go/examples/postgresql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func AddPerson(name string, age int) (*Person, error) {

response, err := postgresql.QueryScalar[int](connection, query, name, age)
if err != nil {
return nil, fmt.Errorf("Failed to add person to database: %v", err)
return nil, fmt.Errorf("failed to add person to database: %v", err)
}

p := Person{Id: response.Value, Name: name, Age: age}
Expand All @@ -65,11 +65,11 @@ func UpdatePersonHome(id int, longitude, latitude float64) (*Person, error) {

response, err := postgresql.Execute(connection, query, longitude, latitude, id)
if err != nil {
return nil, fmt.Errorf("Failed to update person in database: %v", err)
return nil, fmt.Errorf("failed to update person in database: %v", err)
}

if response.RowsAffected != 1 {
return nil, fmt.Errorf("Failed to update person with id %d. The record may not exist.", id)
return nil, fmt.Errorf("failed to update person with id %d - the record may not exist", id)
}

return GetPerson(id)
Expand All @@ -80,11 +80,11 @@ func DeletePerson(id int) (string, error) {

response, err := postgresql.Execute(connection, query, id)
if err != nil {
return "", fmt.Errorf("Failed to delete person from database: %v", err)
return "", fmt.Errorf("failed to delete person from database: %v", err)
}

if response.RowsAffected != 1 {
return "", fmt.Errorf("Failed to delete person with id %d. The record may not exist.", id)
return "", fmt.Errorf("failed to delete person with id %d - the record may not exist", id)
}

return "success", nil
Expand Down
8 changes: 4 additions & 4 deletions sdk/go/examples/textgeneration/toolcalling.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func GenerateTextWithTools(prompt string) (string, error) {
}

default:
return "", fmt.Errorf("Unknown tool call: %s", tc.Function.Name)
return "", fmt.Errorf("unknown tool call: %s", tc.Function.Name)
}

// Add the tool's response to the conversation.
Expand All @@ -124,7 +124,7 @@ func GenerateTextWithTools(prompt string) (string, error) {
return strings.TrimSpace(msg.Content), nil
} else {
// If the model didn't ask for tools, and didn't return any content, something went wrong.
return "", errors.New("Invalid response from model.")
return "", errors.New("invalid response from model")
}
}
}
Expand All @@ -135,7 +135,7 @@ func GenerateTextWithTools(prompt string) (string, error) {
// This function will return the current time in a given time zone.
func getCurrentTime(tz string) (string, error) {
if !localtime.IsValidTimeZone(tz) {
return "", errors.New("Invalid time zone.")
return "", errors.New("invalid time zone")
}

now, err := localtime.NowInZone(tz)
Expand All @@ -159,7 +159,7 @@ func getUserTimeZone() string {
func getCurrentTimeInUserTimeZone() (*struct{ Time, Zone string }, error) {
tz := os.Getenv("TZ")
if tz == "" {
return nil, errors.New("Cannot determine user's time zone.")
return nil, errors.New("cannot determine user's time zone")
}
time, err := getCurrentTime(tz)
if err != nil {
Expand Down
Loading