Migrate golanglint-ci config to V2 (#21081)

This commit is contained in:
Taran Pelkey
2025-03-29 20:56:02 -04:00
committed by GitHub
parent b67f0cf721
commit e88d494775
77 changed files with 239 additions and 290 deletions

View File

@@ -138,6 +138,17 @@ func (endpoint *Endpoint) SetDiskIndex(i int) {
endpoint.DiskIdx = i
}
func isValidURLEndpoint(u *url.URL) bool {
// URL style of endpoint.
// Valid URL style endpoint is
// - Scheme field must contain "http" or "https"
// - All field should be empty except Host and Path.
isURLOk := (u.Scheme == "http" || u.Scheme == "https") &&
u.User == nil && u.Opaque == "" && !u.ForceQuery &&
u.RawQuery == "" && u.Fragment == ""
return isURLOk
}
// NewEndpoint - returns new endpoint based on given arguments.
func NewEndpoint(arg string) (ep Endpoint, e error) {
// isEmptyPath - check whether given path is not empty.
@@ -157,8 +168,7 @@ func NewEndpoint(arg string) (ep Endpoint, e error) {
// Valid URL style endpoint is
// - Scheme field must contain "http" or "https"
// - All field should be empty except Host and Path.
if !((u.Scheme == "http" || u.Scheme == "https") &&
u.User == nil && u.Opaque == "" && !u.ForceQuery && u.RawQuery == "" && u.Fragment == "") {
if !isValidURLEndpoint(u) {
return ep, fmt.Errorf("invalid URL endpoint format")
}
@@ -604,11 +614,8 @@ func (endpoints Endpoints) UpdateIsLocal() error {
startTime := time.Now()
keepAliveTicker := time.NewTicker(500 * time.Millisecond)
defer keepAliveTicker.Stop()
for {
for !foundLocal && (epsResolved != len(endpoints)) {
// Break if the local endpoint is found already Or all the endpoints are resolved.
if foundLocal || (epsResolved == len(endpoints)) {
break
}
// Retry infinitely on Kubernetes and Docker swarm.
// This is needed as the remote hosts are sometime
@@ -794,11 +801,8 @@ func (p PoolEndpointList) UpdateIsLocal() error {
startTime := time.Now()
keepAliveTicker := time.NewTicker(1 * time.Second)
defer keepAliveTicker.Stop()
for {
for !foundLocal && (epsResolved != epCount) {
// Break if the local endpoint is found already Or all the endpoints are resolved.
if foundLocal || (epsResolved == epCount) {
break
}
// Retry infinitely on Kubernetes and Docker swarm.
// This is needed as the remote hosts are sometime