style: fix golines formatting issues in config and vertex provider

- Run `golines -w` on `pkg/config/config.go` and `pkg/providers/vertex/provider.go` to fix line length and struct tag alignment issues reported by `golangci-lint` during the CI run.

Co-authored-by: TanLuong <28281768+TanLuong@users.noreply.github.com>
This commit is contained in:
google-labs-jules[bot] 2026-03-26 16:22:26 +00:00
parent bc17dd338b
commit d250fca6cd
2 changed files with 47 additions and 13 deletions

View file

@ -1279,7 +1279,10 @@ func LoadConfig(path string) (*Config, error) {
data, err := os.ReadFile(path) data, err := os.ReadFile(path)
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
logger.WarnF("config file not found, using default config", map[string]any{"path": path}) logger.WarnF(
"config file not found, using default config",
map[string]any{"path": path},
)
return DefaultConfig(), nil return DefaultConfig(), nil
} }
logger.Errorf("failed to read config file: %v", err) logger.Errorf("failed to read config file: %v", err)
@ -1302,7 +1305,10 @@ func LoadConfig(path string) (*Config, error) {
var cfg *Config var cfg *Config
switch versionInfo.Version { switch versionInfo.Version {
case 0: case 0:
logger.InfoF("config migrate start", map[string]any{"from": versionInfo.Version, "to": CurrentVersion}) logger.InfoF(
"config migrate start",
map[string]any{"from": versionInfo.Version, "to": CurrentVersion},
)
// Legacy config (no version field) // Legacy config (no version field)
v, e := loadConfigV0(data) v, e := loadConfigV0(data)
if e != nil { if e != nil {
@ -1310,10 +1316,16 @@ func LoadConfig(path string) (*Config, error) {
} }
cfg, e = v.Migrate() cfg, e = v.Migrate()
if e != nil { if e != nil {
logger.ErrorF("config migrate fail", map[string]any{"from": versionInfo.Version, "to": CurrentVersion}) logger.ErrorF(
"config migrate fail",
map[string]any{"from": versionInfo.Version, "to": CurrentVersion},
)
return nil, e return nil, e
} }
logger.InfoF("config migrate success", map[string]any{"from": versionInfo.Version, "to": CurrentVersion}) logger.InfoF(
"config migrate success",
map[string]any{"from": versionInfo.Version, "to": CurrentVersion},
)
err = makeBackup(path) err = makeBackup(path)
if err != nil { if err != nil {
return nil, err return nil, err
@ -1321,13 +1333,19 @@ func LoadConfig(path string) (*Config, error) {
// Load existing security config and merge with migrated one to prevent data loss // Load existing security config and merge with migrated one to prevent data loss
existingSec, secErr := loadSecurityConfig(securityPath(path)) existingSec, secErr := loadSecurityConfig(securityPath(path))
if secErr != nil { if secErr != nil {
logger.WarnF("failed to load existing security config during migration", map[string]any{"error": secErr}) logger.WarnF(
"failed to load existing security config during migration",
map[string]any{"error": secErr},
)
} }
if existingSec != nil && cfg.security != nil { if existingSec != nil && cfg.security != nil {
cfg.security = mergeSecurityConfig(existingSec, cfg.security) cfg.security = mergeSecurityConfig(existingSec, cfg.security)
// Re-apply the merged security config to update all channels and models // Re-apply the merged security config to update all channels and models
if err = applySecurityConfig(cfg, cfg.security); err != nil { if err = applySecurityConfig(cfg, cfg.security); err != nil {
logger.WarnF("failed to re-apply merged security config during migration", map[string]any{"error": err}) logger.WarnF(
"failed to re-apply merged security config during migration",
map[string]any{"error": err},
)
} }
} }
defer func(cfg *Config) { defer func(cfg *Config) {
@ -1348,7 +1366,10 @@ func LoadConfig(path string) (*Config, error) {
tmpCfgMigrated, e := tmpCfg.Migrate() tmpCfgMigrated, e := tmpCfg.Migrate()
if e != nil { if e != nil {
logger.ErrorF("config migrate fail", map[string]any{"from": versionInfo.Version, "to": CurrentVersion}) logger.ErrorF(
"config migrate fail",
map[string]any{"from": versionInfo.Version, "to": CurrentVersion},
)
return nil, e return nil, e
} }
@ -1371,9 +1392,11 @@ func LoadConfig(path string) (*Config, error) {
for _, m := range cfg.ModelList { for _, m := range cfg.ModelList {
for _, k := range m.apiKeys { for _, k := range m.apiKeys {
if k != "" && !strings.HasPrefix(k, "enc://") && !strings.HasPrefix(k, "file://") { if k != "" && !strings.HasPrefix(k, "enc://") && !strings.HasPrefix(k, "file://") {
fmt.Fprintf(os.Stderr, fmt.Fprintf(
os.Stderr,
"picoclaw: warning: model %q has a plaintext api_key; call SaveConfig to encrypt it\n", "picoclaw: warning: model %q has a plaintext api_key; call SaveConfig to encrypt it\n",
m.ModelName) m.ModelName,
)
break // Only warn once per model break // Only warn once per model
} }
} }

View file

@ -87,7 +87,14 @@ func (p *Provider) buildURL(model string, action string) string {
if region == "" { if region == "" {
region = "us-central1" region = "us-central1"
} }
baseURL = fmt.Sprintf("https://%s-aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s", region, p.projectID, region, model, action) baseURL = fmt.Sprintf(
"https://%s-aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:%s",
region,
p.projectID,
region,
model,
action,
)
} }
// Only append ?key= for custom apiBase endpoints // Only append ?key= for custom apiBase endpoints
@ -438,7 +445,11 @@ func (p *Provider) ChatStream(
if part.FunctionCall != nil { if part.FunctionCall != nil {
argsJSON, _ := json.Marshal(part.FunctionCall.Args) argsJSON, _ := json.Marshal(part.FunctionCall.Args)
toolCall := ToolCall{ toolCall := ToolCall{
ID: fmt.Sprintf("call_%s_%d", part.FunctionCall.Name, time.Now().UnixNano()), ID: fmt.Sprintf(
"call_%s_%d",
part.FunctionCall.Name,
time.Now().UnixNano(),
),
Name: part.FunctionCall.Name, Name: part.FunctionCall.Name,
Arguments: part.FunctionCall.Args, Arguments: part.FunctionCall.Args,
Function: &FunctionCall{ Function: &FunctionCall{