Replace fmt, errors, strings, path/filepath, encoding/json with Core primitives across 23 files. Keep encoding/json for streaming NewDecoder/NewEncoder, strings for Fields/FieldsFuncSeq. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
19 lines
431 B
Go
19 lines
431 B
Go
package forge
|
|
|
|
import (
|
|
"net/url"
|
|
|
|
core "dappco.re/go/core"
|
|
)
|
|
|
|
// Params maps path variable names to values.
|
|
// Example: Params{"owner": "core", "repo": "go-forge"}
|
|
type Params map[string]string
|
|
|
|
// ResolvePath substitutes {placeholders} in path with values from params.
|
|
func ResolvePath(path string, params Params) string {
|
|
for k, v := range params {
|
|
path = core.Replace(path, "{"+k+"}", url.PathEscape(v))
|
|
}
|
|
return path
|
|
}
|