fix go.mod

This commit is contained in:
2026-08-11 15:36:08 +08:00
parent 581a503883
commit e0d7827da2
6 changed files with 45 additions and 67 deletions

View File

@@ -3,12 +3,9 @@ package main
import (
"context"
"flag"
"fmt"
"net/http"
"os"
"os/signal"
"regexp"
"strings"
"syscall"
"time"
@@ -16,24 +13,16 @@ import (
"bsm/full/all/internal/impl"
allserver "bsm/full/all/internal/server"
"bsm/full/all/internal/service"
"git.apinb.com/bsm-sdk/core/utils"
)
var ServiceKey = "default"
var workspacePattern = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$`)
func normalizeWorkspace(value string) (string, error) {
value = strings.ToLower(strings.TrimSpace(value))
if !workspacePattern.MatchString(value) {
return "", fmt.Errorf("workspace must match %s", workspacePattern.String())
}
return value, nil
}
func main() {
workspace := flag.String("workspace", ServiceKey, "workspace used to select etc/{workspace}_{runtime}.yaml")
flag.Parse()
value, err := normalizeWorkspace(*workspace)
value, err := utils.MustString(*workspace)
if err != nil {
panic(err)
}