c572fcfe04
Rename the Go module path from code.gitea.io/gitea to git.mokoconsulting.tech/MokoConsulting/MokoGitea across the entire codebase. Scope: - go.mod module declaration - 2,235 Go source files (import paths) - Dockerfile WORKDIR and COPY paths - Swagger API templates - golangci.yml linter config External dependencies (code.gitea.io/gitea-vet, code.gitea.io/sdk/gitea, gitea.com/gitea/act, etc.) are intentionally NOT renamed — they are separate upstream modules. Closes #132 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
33 lines
821 B
Go
33 lines
821 B
Go
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package util
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCallerFuncName(t *testing.T) {
|
|
s := CallerFuncName()
|
|
assert.Equal(t, "git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/util.TestCallerFuncName", s)
|
|
}
|
|
|
|
func BenchmarkCallerFuncName(b *testing.B) {
|
|
// BenchmarkCaller/sprintf-12 12744829 95.49 ns/op
|
|
b.Run("sprintf", func(b *testing.B) {
|
|
for b.Loop() {
|
|
_ = fmt.Sprintf("aaaaaaaaaaaaaaaa %s %s %s", "bbbbbbbbbbbbbbbbbbb", b.Name(), "ccccccccccccccccccccc")
|
|
}
|
|
})
|
|
// BenchmarkCaller/caller-12 10625133 113.6 ns/op
|
|
// It is almost as fast as fmt.Sprintf
|
|
b.Run("caller", func(b *testing.B) {
|
|
for b.Loop() {
|
|
CallerFuncName()
|
|
}
|
|
})
|
|
}
|