chore: linter: embeddedstructfieldcheck

Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Jakob Borg
2025-10-21 22:00:44 +02:00
parent df8d8c276e
commit 7c9d06b4d2
36 changed files with 54 additions and 11 deletions

View File

@@ -653,6 +653,7 @@ func getLocation(host string, geoip *geoip.Provider) location {
type loggingResponseWriter struct { type loggingResponseWriter struct {
http.ResponseWriter http.ResponseWriter
statusCode int statusCode int
} }

View File

@@ -23,6 +23,7 @@ import (
type amqpReplicator struct { type amqpReplicator struct {
suture.Service suture.Service
broker string broker string
sender *amqpSender sender *amqpSender
receiver *amqpReceiver receiver *amqpReceiver

View File

@@ -513,6 +513,7 @@ func fixupAddresses(remote *net.TCPAddr, addresses []string) []string {
type loggingResponseWriter struct { type loggingResponseWriter struct {
http.ResponseWriter http.ResponseWriter
statusCode int statusCode int
} }

View File

@@ -32,6 +32,7 @@ type APIClient interface {
type apiClient struct { type apiClient struct {
http.Client http.Client
cfg config.GUIConfiguration cfg config.GUIConfiguration
apikey string apikey string
} }

View File

@@ -10,6 +10,7 @@ import "github.com/jmoiron/sqlx"
type txPreparedStmts struct { type txPreparedStmts struct {
*sqlx.Tx *sqlx.Tx
stmts map[string]*sqlx.Stmt stmts map[string]*sqlx.Stmt
} }

View File

@@ -14,9 +14,10 @@ import (
) )
type folderDB struct { type folderDB struct {
folderID string
*baseDB *baseDB
folderID string
localDeviceIdx int64 localDeviceIdx int64
deleteRetention time.Duration deleteRetention time.Duration
} }

View File

@@ -22,6 +22,7 @@ import (
type configMuxBuilder struct { type configMuxBuilder struct {
*httprouter.Router *httprouter.Router
id protocol.DeviceID id protocol.DeviceID
cfg config.Wrapper cfg config.Wrapper
} }

View File

@@ -32,6 +32,7 @@ type Interface interface {
type cast struct { type cast struct {
*suture.Supervisor *suture.Supervisor
name string name string
reader svcutil.ServiceWithError reader svcutil.ServiceWithError
writer svcutil.ServiceWithError writer svcutil.ServiceWithError

View File

@@ -165,6 +165,7 @@ func (cfg *Configuration) ProbeFreePorts() error {
type xmlConfiguration struct { type xmlConfiguration struct {
Configuration Configuration
XMLName xml.Name `xml:"configuration"` XMLName xml.Name `xml:"configuration"`
} }

View File

@@ -11,6 +11,7 @@ import "github.com/syncthing/syncthing/lib/config"
// invalidListener is never valid // invalidListener is never valid
type invalidListener struct { type invalidListener struct {
listenerFactory listenerFactory
err error err error
} }
@@ -25,6 +26,7 @@ func (i invalidListener) Valid(_ config.Configuration) error {
// invalidDialer is never valid // invalidDialer is never valid
type invalidDialer struct { type invalidDialer struct {
dialerFactory dialerFactory
err error err error
} }

View File

@@ -225,8 +225,9 @@ func getRateLimiter(m map[protocol.DeviceID]*rate.Limiter, deviceID protocol.Dev
// limitedReader is a rate limited io.Reader // limitedReader is a rate limited io.Reader
type limitedReader struct { type limitedReader struct {
reader io.Reader
waiterHolder waiterHolder
reader io.Reader
} }
func (r *limitedReader) Read(buf []byte) (int, error) { func (r *limitedReader) Read(buf []byte) (int, error) {
@@ -239,8 +240,9 @@ func (r *limitedReader) Read(buf []byte) (int, error) {
// limitedWriter is a rate limited io.Writer // limitedWriter is a rate limited io.Writer
type limitedWriter struct { type limitedWriter struct {
writer io.Writer
waiterHolder waiterHolder
writer io.Writer
} }
func (w *limitedWriter) Write(buf []byte) (int, error) { func (w *limitedWriter) Write(buf []byte) (int, error) {

View File

@@ -39,6 +39,7 @@ func init() {
type quicDialer struct { type quicDialer struct {
commonDialer commonDialer
registry *registry.Registry registry *registry.Registry
} }

View File

@@ -39,10 +39,10 @@ func init() {
type quicListener struct { type quicListener struct {
svcutil.ServiceWithError svcutil.ServiceWithError
nat atomic.Uint64 // Holds a stun.NATType.
onAddressesChangedNotifier onAddressesChangedNotifier
nat atomic.Uint64 // Holds a stun.NATType.
uri *url.URL uri *url.URL
cfg config.Wrapper cfg config.Wrapper
tlsCfg *tls.Config tlsCfg *tls.Config

View File

@@ -42,6 +42,7 @@ func quicNetwork(uri *url.URL) string {
type quicTlsConn struct { type quicTlsConn struct {
quic.Connection quic.Connection
quic.Stream quic.Stream
// If we created this connection, we should be the ones closing it. // If we created this connection, we should be the ones closing it.
createdConn net.PacketConn createdConn net.PacketConn
} }

View File

@@ -39,6 +39,7 @@ type tlsConn interface {
// came from (type, priority). // came from (type, priority).
type internalConn struct { type internalConn struct {
tlsConn tlsConn
connType connType connType connType
isLocal bool isLocal bool
priority int priority int

View File

@@ -27,6 +27,7 @@ func init() {
type tcpDialer struct { type tcpDialer struct {
commonDialer commonDialer
registry *registry.Registry registry *registry.Registry
} }

View File

@@ -64,6 +64,7 @@ func socksDialerFunction(u *url.URL, forward proxy.Dialer) (proxy.Dialer, error)
// existing connection" shenanigans. // existing connection" shenanigans.
type dialerConn struct { type dialerConn struct {
net.Conn net.Conn
addr net.Addr addr net.Addr
} }

View File

@@ -17,6 +17,7 @@ import (
// A cachedFinder is a Finder with associated cache timeouts. // A cachedFinder is a Finder with associated cache timeouts.
type cachedFinder struct { type cachedFinder struct {
Finder Finder
cacheTime time.Duration cacheTime time.Duration
negCacheTime time.Duration negCacheTime time.Duration
cache *cache cache *cache

View File

@@ -32,6 +32,8 @@ import (
) )
type globalClient struct { type globalClient struct {
errorHolder
server string server string
addrList AddressLister addrList AddressLister
announceClient httpClient announceClient httpClient
@@ -39,7 +41,6 @@ type globalClient struct {
noAnnounce bool noAnnounce bool
noLookup bool noLookup bool
evLogger events.Logger evLogger events.Logger
errorHolder
} }
type httpClient interface { type httpClient interface {
@@ -373,6 +374,7 @@ func queryBool(q url.Values, key string) bool {
type idCheckingHTTPClient struct { type idCheckingHTTPClient struct {
httpClient httpClient
id protocol.DeviceID id protocol.DeviceID
} }

View File

@@ -34,6 +34,8 @@ import (
type localClient struct { type localClient struct {
*suture.Supervisor *suture.Supervisor
*cache
myID protocol.DeviceID myID protocol.DeviceID
addrList AddressLister addrList AddressLister
name string name string
@@ -43,8 +45,6 @@ type localClient struct {
localBcastStart time.Time localBcastStart time.Time
localBcastTick <-chan time.Time localBcastTick <-chan time.Time
forcedBcastTick chan time.Time forcedBcastTick chan time.Time
*cache
} }
const ( const (

View File

@@ -41,6 +41,7 @@ type Manager interface {
type manager struct { type manager struct {
*suture.Supervisor *suture.Supervisor
myID protocol.DeviceID myID protocol.DeviceID
cfg config.Wrapper cfg config.Wrapper
cert tls.Certificate cert tls.Certificate

View File

@@ -340,6 +340,7 @@ func (*BasicFilesystem) underlying() (Filesystem, bool) {
// basicFile implements the fs.File interface on top of an os.File // basicFile implements the fs.File interface on top of an os.File
type basicFile struct { type basicFile struct {
*os.File *os.File
name string name string
} }

View File

@@ -749,6 +749,7 @@ func (fs *fakeFS) reportMetricsPer(b *testing.B, divisor float64, unit string) {
// opened for reading or writing, it's all good. // opened for reading or writing, it's all good.
type fakeFile struct { type fakeFile struct {
*fakeEntry *fakeEntry
mut *sync.Mutex mut *sync.Mutex
rng io.Reader rng io.Reader
seed int64 seed int64

View File

@@ -16,6 +16,7 @@ import (
type logFilesystem struct { type logFilesystem struct {
Filesystem Filesystem
// Number of filesystem layers on top of logFilesystem to skip when looking // Number of filesystem layers on top of logFilesystem to skip when looking
// for the true caller of the filesystem // for the true caller of the filesystem
layers int layers int

View File

@@ -19,6 +19,7 @@ type database interface {
type mtimeFS struct { type mtimeFS struct {
Filesystem Filesystem
chtimes func(string, time.Time, time.Time) error chtimes func(string, time.Time, time.Time) error
db database db database
folderID string folderID string
@@ -170,6 +171,7 @@ func (f *mtimeFS) load(name string) (ondisk, virtual time.Time) {
type mtimeFileInfo struct { type mtimeFileInfo struct {
FileInfo FileInfo
mtime time.Time mtime time.Time
} }
@@ -179,6 +181,7 @@ func (m mtimeFileInfo) ModTime() time.Time {
type mtimeFile struct { type mtimeFile struct {
File File
fs *mtimeFS fs *mtimeFS
} }

View File

@@ -63,6 +63,7 @@ type WalkFunc func(path string, info FileInfo, err error) error
type walkFilesystem struct { type walkFilesystem struct {
Filesystem Filesystem
checkInfiniteRecursion bool checkInfiniteRecursion bool
} }

View File

@@ -44,6 +44,7 @@ type folder struct {
stateTracker stateTracker
config.FolderConfiguration config.FolderConfiguration
*stats.FolderStatisticsReference *stats.FolderStatisticsReference
ioLimiter *semaphore.Semaphore ioLimiter *semaphore.Semaphore
localFlags protocol.FlagLocal localFlags protocol.FlagLocal

View File

@@ -48,6 +48,7 @@ func init() {
// to be fetched. // to be fetched.
type pullBlockState struct { type pullBlockState struct {
*sharedPullerState *sharedPullerState
block protocol.BlockInfo block protocol.BlockInfo
} }
@@ -55,6 +56,7 @@ type pullBlockState struct {
// copied. // copied.
type copyBlocksState struct { type copyBlocksState struct {
*sharedPullerState *sharedPullerState
blocks []protocol.BlockInfo blocks []protocol.BlockInfo
have int have int
} }

View File

@@ -690,6 +690,7 @@ type ConnectionStats struct {
type ConnectionInfo struct { type ConnectionInfo struct {
protocol.Statistics protocol.Statistics
Address string `json:"address"` Address string `json:"address"`
Type string `json:"type"` Type string `json:"type"`
IsLocal bool `json:"isLocal"` IsLocal bool `json:"isLocal"`
@@ -3484,6 +3485,7 @@ func redactPathError(err error) (error, bool) {
type redactedError struct { type redactedError struct {
error error
redacted error redacted error
} }

View File

@@ -14,6 +14,7 @@ import (
type countingReader struct { type countingReader struct {
io.Reader io.Reader
idString string idString string
tot atomic.Int64 // bytes tot atomic.Int64 // bytes
last atomic.Int64 // unix nanos last atomic.Int64 // unix nanos
@@ -41,6 +42,7 @@ func (c *countingReader) Last() time.Time {
type countingWriter struct { type countingWriter struct {
io.Writer io.Writer
idString string idString string
tot atomic.Int64 // bytes tot atomic.Int64 // bytes
last atomic.Int64 // unix nanos last atomic.Int64 // unix nanos

View File

@@ -171,6 +171,7 @@ func (e encryptedModel) Closed(err error) {
// encrypts outgoing metadata and decrypts incoming responses. // encrypts outgoing metadata and decrypts incoming responses.
type encryptedConnection struct { type encryptedConnection struct {
ConnectionInfo ConnectionInfo
conn *rawConnection conn *rawConnection
folderKeys *folderKeyRegistry folderKeys *folderKeyRegistry
keyGen *KeyGenerator keyGen *KeyGenerator

View File

@@ -38,6 +38,7 @@ func NewClient(uri *url.URL, certs []tls.Certificate, timeout time.Duration) (Re
type commonClient struct { type commonClient struct {
svcutil.ServiceWithError svcutil.ServiceWithError
invitations chan protocol.SessionInvitation invitations chan protocol.SessionInvitation
} }

View File

@@ -681,9 +681,10 @@ func (w *walker) String() string {
// A byteCounter gets bytes added to it via Update() and then provides the // A byteCounter gets bytes added to it via Update() and then provides the
// Total() and one minute moving average Rate() in bytes per second. // Total() and one minute moving average Rate() in bytes per second.
type byteCounter struct { type byteCounter struct {
total atomic.Int64
metrics.EWMA metrics.EWMA
stop chan struct{}
total atomic.Int64
stop chan struct{}
} }
func newByteCounter() *byteCounter { func newByteCounter() *byteCounter {

View File

@@ -200,6 +200,7 @@ func NewCertificateInMemory(commonName string, lifetimeDays int) (tls.Certificat
type DowngradingListener struct { type DowngradingListener struct {
net.Listener net.Listener
TLSConfig *tls.Config TLSConfig *tls.Config
} }
@@ -244,9 +245,10 @@ func (l *DowngradingListener) AcceptNoWrapTLS() (net.Conn, bool, error) {
} }
type UnionedConnection struct { type UnionedConnection struct {
net.Conn
first [1]byte first [1]byte
firstDone bool firstDone bool
net.Conn
} }
func (c *UnionedConnection) Read(b []byte) (n int, err error) { func (c *UnionedConnection) Read(b []byte) (n int, err error) {

View File

@@ -41,6 +41,7 @@ var (
type FailureReport struct { type FailureReport struct {
FailureData FailureData
Count int Count int
Version string Version string
} }

View File

@@ -55,6 +55,7 @@ func New(cfg config.FolderConfiguration) (Versioner, error) {
type versionerWithErrorContext struct { type versionerWithErrorContext struct {
Versioner Versioner
vtype string vtype string
} }