all: Remove lib/util package (#9049)
Grab-bag packages are nasty, this cleans it up a little by splitting it into topical packages sempahore, netutil, stringutil, structutil.
This commit is contained in:
+2
-2
@@ -44,8 +44,8 @@ import (
|
||||
"github.com/syncthing/syncthing/lib/sync"
|
||||
"github.com/syncthing/syncthing/lib/tlsutil"
|
||||
"github.com/syncthing/syncthing/lib/ur"
|
||||
"github.com/syncthing/syncthing/lib/util"
|
||||
"github.com/thejerf/suture/v4"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -1313,7 +1313,7 @@ func TestBrowse(t *testing.T) {
|
||||
|
||||
for _, tc := range cases {
|
||||
ret := browseFiles(ffs, tc.current)
|
||||
if !util.EqualStrings(ret, tc.returns) {
|
||||
if !slices.Equal(ret, tc.returns) {
|
||||
t.Errorf("browseFiles(%q) => %q, expected %q", tc.current, ret, tc.returns)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
"github.com/syncthing/syncthing/lib/config"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
"github.com/syncthing/syncthing/lib/util"
|
||||
"github.com/syncthing/syncthing/lib/structutil"
|
||||
)
|
||||
|
||||
type configMuxBuilder struct {
|
||||
@@ -212,7 +212,7 @@ func (c *configMuxBuilder) registerDefaultFolder(path string) {
|
||||
|
||||
c.HandlerFunc(http.MethodPut, path, func(w http.ResponseWriter, r *http.Request) {
|
||||
var cfg config.FolderConfiguration
|
||||
util.SetDefaults(&cfg)
|
||||
structutil.SetDefaults(&cfg)
|
||||
c.adjustFolder(w, r, cfg, true)
|
||||
})
|
||||
|
||||
@@ -228,7 +228,7 @@ func (c *configMuxBuilder) registerDefaultDevice(path string) {
|
||||
|
||||
c.HandlerFunc(http.MethodPut, path, func(w http.ResponseWriter, r *http.Request) {
|
||||
var cfg config.DeviceConfiguration
|
||||
util.SetDefaults(&cfg)
|
||||
structutil.SetDefaults(&cfg)
|
||||
c.adjustDevice(w, r, cfg, true)
|
||||
})
|
||||
|
||||
@@ -266,7 +266,7 @@ func (c *configMuxBuilder) registerOptions(path string) {
|
||||
|
||||
c.HandlerFunc(http.MethodPut, path, func(w http.ResponseWriter, r *http.Request) {
|
||||
var cfg config.OptionsConfiguration
|
||||
util.SetDefaults(&cfg)
|
||||
structutil.SetDefaults(&cfg)
|
||||
c.adjustOptions(w, r, cfg)
|
||||
})
|
||||
|
||||
@@ -282,7 +282,7 @@ func (c *configMuxBuilder) registerLDAP(path string) {
|
||||
|
||||
c.HandlerFunc(http.MethodPut, path, func(w http.ResponseWriter, r *http.Request) {
|
||||
var cfg config.LDAPConfiguration
|
||||
util.SetDefaults(&cfg)
|
||||
structutil.SetDefaults(&cfg)
|
||||
c.adjustLDAP(w, r, cfg)
|
||||
})
|
||||
|
||||
@@ -298,7 +298,7 @@ func (c *configMuxBuilder) registerGUI(path string) {
|
||||
|
||||
c.HandlerFunc(http.MethodPut, path, func(w http.ResponseWriter, r *http.Request) {
|
||||
var cfg config.GUIConfiguration
|
||||
util.SetDefaults(&cfg)
|
||||
structutil.SetDefaults(&cfg)
|
||||
c.adjustGUI(w, r, cfg)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user