chore: ugh, lint fix... (#7275)

* chore: ugh, lint fix...

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

* more lint fixes

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>

---------

Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
This commit is contained in:
Mohammed Al Sahaf 2025-09-26 11:14:48 +04:00 committed by GitHub
parent 0c8798fce3
commit 25be2f26fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 48 additions and 48 deletions

View file

@ -975,11 +975,11 @@ func Version() (simple, full string) {
if CustomVersion != "" {
full = CustomVersion
simple = CustomVersion
return
return simple, full
}
full = "unknown"
simple = "unknown"
return
return simple, full
}
// find the Caddy module in the dependency list
for _, dep := range bi.Deps {
@ -1059,7 +1059,7 @@ func Version() (simple, full string) {
}
}
return
return simple, full
}
// Event represents something that has happened or is happening.

View file

@ -62,7 +62,7 @@ func splitModule(arg string) (module, version string, err error) {
err = fmt.Errorf("module name is required")
}
return
return module, version, err
}
func cmdAddPackage(fl Flags) (int, error) {
@ -217,7 +217,7 @@ func getModules() (standard, nonstandard, unknown []moduleInfo, err error) {
bi, ok := debug.ReadBuildInfo()
if !ok {
err = fmt.Errorf("no build info")
return
return standard, nonstandard, unknown, err
}
for _, modID := range caddy.Modules() {
@ -260,7 +260,7 @@ func getModules() (standard, nonstandard, unknown []moduleInfo, err error) {
nonstandard = append(nonstandard, caddyModGoMod)
}
}
return
return standard, nonstandard, unknown, err
}
func listModules(path string) error {

View file

@ -261,14 +261,14 @@ func (fcpc *fakeClosePacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err e
if atomic.LoadInt32(&fcpc.closed) == 1 {
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
if err = fcpc.SetReadDeadline(time.Time{}); err != nil {
return
return n, addr, err
}
}
}
return
return n, addr, err
}
return
return n, addr, err
}
// Close won't close the underlying socket unless there is no more reference, then listenerPool will close it.

View file

@ -382,7 +382,7 @@ func SplitNetworkAddress(a string) (network, host, port string, err error) {
a = afterSlash
if IsUnixNetwork(network) || IsFdNetwork(network) {
host = a
return
return network, host, port, err
}
}
@ -402,7 +402,7 @@ func SplitNetworkAddress(a string) (network, host, port string, err error) {
err = errors.Join(firstErr, err)
}
return
return network, host, port, err
}
// JoinNetworkAddress combines network, host, and port into a single

View file

@ -209,7 +209,7 @@ func errLogValues(err error) (status int, msg string, fields func() []zapcore.Fi
zap.String("err_trace", handlerErr.Trace),
}
}
return
return status, msg, fields
}
fields = func() []zapcore.Field {
return []zapcore.Field{
@ -218,7 +218,7 @@ func errLogValues(err error) (status int, msg string, fields func() []zapcore.Fi
}
status = http.StatusInternalServerError
msg = err.Error()
return
return status, msg, fields
}
// ExtraLogFields is a list of extra fields to log with every request.

View file

@ -116,7 +116,7 @@ func (ew errorWrapper) Read(p []byte) (n int, err error) {
if errors.As(err, &mbe) {
err = caddyhttp.Error(http.StatusRequestEntityTooLarge, err)
}
return
return n, err
}
// Interface guard

View file

@ -154,13 +154,13 @@ func (c *client) Do(p map[string]string, req io.Reader) (r io.Reader, err error)
err = writer.writeBeginRequest(uint16(Responder), 0)
if err != nil {
return
return r, err
}
writer.recType = Params
err = writer.writePairs(p)
if err != nil {
return
return r, err
}
writer.recType = Stdin
@ -176,7 +176,7 @@ func (c *client) Do(p map[string]string, req io.Reader) (r io.Reader, err error)
}
r = &streamReader{c: c}
return
return r, err
}
// clientCloser is a io.ReadCloser. It wraps a io.Reader with a Closer
@ -213,7 +213,7 @@ func (f clientCloser) Close() error {
func (c *client) Request(p map[string]string, req io.Reader) (resp *http.Response, err error) {
r, err := c.Do(p, req)
if err != nil {
return
return resp, err
}
rb := bufio.NewReader(r)
@ -223,7 +223,7 @@ func (c *client) Request(p map[string]string, req io.Reader) (resp *http.Respons
// Parse the response headers.
mimeHeader, err := tp.ReadMIMEHeader()
if err != nil && err != io.EOF {
return
return resp, err
}
resp.Header = http.Header(mimeHeader)
@ -231,7 +231,7 @@ func (c *client) Request(p map[string]string, req io.Reader) (resp *http.Respons
statusNumber, statusInfo, statusIsCut := strings.Cut(resp.Header.Get("Status"), " ")
resp.StatusCode, err = strconv.Atoi(statusNumber)
if err != nil {
return
return resp, err
}
if statusIsCut {
resp.Status = statusInfo
@ -260,7 +260,7 @@ func (c *client) Request(p map[string]string, req io.Reader) (resp *http.Respons
}
resp.Body = closer
return
return resp, err
}
// Get issues a GET request to the fcgi responder.
@ -329,7 +329,7 @@ func (c *client) PostFile(p map[string]string, data url.Values, file map[string]
for _, v0 := range val {
err = writer.WriteField(key, v0)
if err != nil {
return
return resp, err
}
}
}
@ -347,13 +347,13 @@ func (c *client) PostFile(p map[string]string, data url.Values, file map[string]
}
_, err = io.Copy(part, fd)
if err != nil {
return
return resp, err
}
}
err = writer.Close()
if err != nil {
return
return resp, err
}
return c.Post(p, "POST", bodyType, buf, int64(buf.Len()))

View file

@ -120,7 +120,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[
conn, err := net.Dial("tcp", ipPort)
if err != nil {
log.Println("err:", err)
return
return content
}
fcgi := client{rwc: conn, reqID: 1}
@ -162,7 +162,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[
if err != nil {
log.Println("err:", err)
return
return content
}
defer resp.Body.Close()
@ -176,7 +176,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[
globalt.Error("Server return failed message")
}
return
return content
}
func generateRandFile(size int) (p string, m string) {
@ -206,7 +206,7 @@ func generateRandFile(size int) (p string, m string) {
}
}
m = fmt.Sprintf("%x", h.Sum(nil))
return
return p, m
}
func DisabledTest(t *testing.T) {

View file

@ -30,23 +30,23 @@ func (rec *record) fill(r io.Reader) (err error) {
rec.lr.N = rec.padding
rec.lr.R = r
if _, err = io.Copy(io.Discard, rec); err != nil {
return
return err
}
if err = binary.Read(r, binary.BigEndian, &rec.h); err != nil {
return
return err
}
if rec.h.Version != 1 {
err = errors.New("fcgi: invalid header version")
return
return err
}
if rec.h.Type == EndRequest {
err = io.EOF
return
return err
}
rec.lr.N = int64(rec.h.ContentLength)
rec.padding = int64(rec.h.PaddingLength)
return
return err
}
func (rec *record) Read(p []byte) (n int, err error) {

View file

@ -588,11 +588,11 @@ func (m *maxLatencyWriter) Write(p []byte) (n int, err error) {
m.logger.Debug("flushing immediately")
//nolint:errcheck
m.flush()
return
return n, err
}
if m.flushPending {
m.logger.Debug("delayed flush already pending")
return
return n, err
}
if m.t == nil {
m.t = time.AfterFunc(m.latency, m.delayedFlush)
@ -603,7 +603,7 @@ func (m *maxLatencyWriter) Write(p []byte) (n int, err error) {
c.Write(zap.Duration("duration", m.latency))
}
m.flushPending = true
return
return n, err
}
func (m *maxLatencyWriter) delayedFlush() {

View file

@ -213,12 +213,12 @@ func (su SRVUpstreams) expandedAddr(r *http.Request) (addr, service, proto, name
name = repl.ReplaceAll(su.Name, "")
if su.Service == "" && su.Proto == "" {
addr = name
return
return addr, service, proto, name
}
service = repl.ReplaceAll(su.Service, "")
proto = repl.ReplaceAll(su.Proto, "")
addr = su.formattedAddr(service, proto, name)
return
return addr, service, proto, name
}
// formattedAddr the RFC 2782 representation of the SRV domain, in

View file

@ -220,13 +220,13 @@ func (a *adminAPI) getCAFromAPIRequestPath(r *http.Request) (*CA, error) {
func rootAndIntermediatePEM(ca *CA) (root, inter []byte, err error) {
root, err = pemEncodeCert(ca.RootCertificate().Raw)
if err != nil {
return
return root, inter, err
}
inter, err = pemEncodeCert(ca.IntermediateCertificate().Raw)
if err != nil {
return
return root, inter, err
}
return
return root, inter, err
}
// caInfo is the response structure for the CA info API endpoint.

View file

@ -172,7 +172,7 @@ func (reconn *redialerConn) Write(b []byte) (n int, err error) {
reconn.connMu.RUnlock()
if conn != nil {
if n, err = conn.Write(b); err == nil {
return
return n, err
}
}
@ -184,7 +184,7 @@ func (reconn *redialerConn) Write(b []byte) (n int, err error) {
// one of them might have already re-dialed by now; try writing again
if reconn.Conn != nil {
if n, err = reconn.Conn.Write(b); err == nil {
return
return n, err
}
}
@ -198,7 +198,7 @@ func (reconn *redialerConn) Write(b []byte) (n int, err error) {
if err2 != nil {
// logger socket still offline; instead of discarding the log, dump it to stderr
os.Stderr.Write(b)
return
return n, err
}
if n, err = conn2.Write(b); err == nil {
if reconn.Conn != nil {
@ -211,7 +211,7 @@ func (reconn *redialerConn) Write(b []byte) (n int, err error) {
os.Stderr.Write(b)
}
return
return n, err
}
func (reconn *redialerConn) dial() (net.Conn, error) {

View file

@ -106,7 +106,7 @@ func (up *UsagePool) LoadOrNew(key any, construct Constructor) (value any, loade
}
upv.Unlock()
}
return
return value, loaded, err
}
// LoadOrStore loads the value associated with key from the pool if it
@ -134,7 +134,7 @@ func (up *UsagePool) LoadOrStore(key, val any) (value any, loaded bool) {
up.Unlock()
value = val
}
return
return value, loaded
}
// Range iterates the pool similarly to how sync.Map.Range() does:
@ -191,7 +191,7 @@ func (up *UsagePool) Delete(key any) (deleted bool, err error) {
upv.value, upv.refs))
}
}
return
return deleted, err
}
// References returns the number of references (count of usages) to a