Check / check (pull_request) Successful in 5m19s
The Makefile no longer passes the architecture to the linker. The Buildarch variable in main and the field and setter in globals are gone; the startup log line reports runtime.GOARCH as `arch`. CONVENTIONS.md drops Buildarch from its main, globals, logger and Makefile examples, as the sneak/prompts conventions do. Model: opus-5-5
35 lines
681 B
Go
35 lines
681 B
Go
package logger //nolint:testpackage // sets the unexported log and params fields
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"log/slog"
|
|
"runtime"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"sneak.berlin/go/upaas/internal/globals"
|
|
)
|
|
|
|
func TestIdentifyLogsArchitectureFromRuntime(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
var buf bytes.Buffer
|
|
|
|
l := &Logger{
|
|
log: slog.New(slog.NewJSONHandler(&buf, nil)),
|
|
params: Params{
|
|
Globals: &globals.Globals{Appname: "upaas-test", Version: "test"},
|
|
},
|
|
}
|
|
|
|
l.Identify()
|
|
|
|
var line map[string]any
|
|
|
|
require.NoError(t, json.Unmarshal(buf.Bytes(), &line))
|
|
assert.Equal(t, runtime.GOARCH, line["arch"])
|
|
}
|