diff --git a/datamodel/low/extraction_functions_test.go b/datamodel/low/extraction_functions_test.go index d5685ccd..da59d6b8 100644 --- a/datamodel/low/extraction_functions_test.go +++ b/datamodel/low/extraction_functions_test.go @@ -14,7 +14,6 @@ import ( "strings" "testing" - "golang.org/x/sync/syncmap" "gopkg.in/yaml.v3" "github.com/pb33f/libopenapi/index" @@ -22,6 +21,7 @@ import ( "github.com/pb33f/libopenapi/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "sync" ) func TestFindItemInOrderedMap(t *testing.T) { @@ -1901,7 +1901,7 @@ func TestLocateRefNode_DoARealLookup(t *testing.T) { idx := index.NewSpecIndexWithConfig(&rootNode, cf) // fake cache to a lookup for a file that does not exist will work. - fakeCache := new(syncmap.Map) + fakeCache := new(sync.Map) fakeCache.Store(lookup, &index.Reference{Node: &no, Index: idx}) idx.SetCache(fakeCache) diff --git a/document_iteration_test.go b/document_iteration_test.go index 500225bb..ccd0535c 100644 --- a/document_iteration_test.go +++ b/document_iteration_test.go @@ -10,7 +10,7 @@ import ( v3 "github.com/pb33f/libopenapi/datamodel/high/v3" "github.com/pb33f/libopenapi/orderedmap" "github.com/stretchr/testify/require" - "golang.org/x/exp/slices" + "slices" ) type loopFrame struct { diff --git a/go.mod b/go.mod index a1e259fd..eaab11e5 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,6 @@ require ( github.com/stretchr/testify v1.8.4 github.com/vmware-labs/yaml-jsonpath v0.3.2 github.com/wk8/go-ordered-map/v2 v2.1.8 - golang.org/x/exp v0.0.0-20240213143201-ec583247a57a - golang.org/x/sync v0.6.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 55377f93..3734334e 100644 --- a/go.sum +++ b/go.sum @@ -73,8 +73,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= -golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -87,8 +85,6 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/index/extract_refs.go b/index/extract_refs.go index deddc1ef..2966b813 100644 --- a/index/extract_refs.go +++ b/index/extract_refs.go @@ -12,7 +12,7 @@ import ( "strings" "github.com/pb33f/libopenapi/utils" - "golang.org/x/exp/slices" + "slices" "gopkg.in/yaml.v3" ) diff --git a/index/index_model.go b/index/index_model.go index d42c6075..623262bc 100644 --- a/index/index_model.go +++ b/index/index_model.go @@ -11,7 +11,6 @@ import ( "sync" "github.com/pb33f/libopenapi/datamodel" - "golang.org/x/sync/syncmap" "gopkg.in/yaml.v3" ) @@ -236,7 +235,7 @@ type SpecIndex struct { allRefSchemaDefinitions []*Reference // all schemas found that are references. allInlineSchemaDefinitions []*Reference // all schemas found in document outside of components (openapi) or definitions (swagger). allInlineSchemaObjectDefinitions []*Reference // all schemas that are objects found in document outside of components (openapi) or definitions (swagger). - allComponentSchemaDefinitions *syncmap.Map // all schemas found in components (openapi) or definitions (swagger). + allComponentSchemaDefinitions *sync.Map // all schemas found in components (openapi) or definitions (swagger). securitySchemesNode *yaml.Node // components/securitySchemes node allSecuritySchemes map[string]*Reference // all security schemes / definitions. requestBodiesNode *yaml.Node // components/requestBodies node @@ -273,7 +272,7 @@ type SpecIndex struct { componentIndexChan chan bool polyComponentIndexChan chan bool resolver *Resolver - cache *syncmap.Map + cache *sync.Map built bool uri []string logger *slog.Logger @@ -292,7 +291,7 @@ func (index *SpecIndex) GetConfig() *SpecIndexConfig { return index.config } -func (index *SpecIndex) SetCache(sync *syncmap.Map) { +func (index *SpecIndex) SetCache(sync *sync.Map) { index.cache = sync } @@ -300,7 +299,7 @@ func (index *SpecIndex) GetNodeMap() map[int]map[int]*yaml.Node { return index.nodeMap } -func (index *SpecIndex) GetCache() *syncmap.Map { +func (index *SpecIndex) GetCache() *sync.Map { return index.cache } diff --git a/index/resolver.go b/index/resolver.go index 022d80cf..4e3d0a14 100644 --- a/index/resolver.go +++ b/index/resolver.go @@ -11,7 +11,7 @@ import ( "strings" "github.com/pb33f/libopenapi/utils" - "golang.org/x/exp/slices" + "slices" "gopkg.in/yaml.v3" ) diff --git a/index/rolodex_file_loader.go b/index/rolodex_file_loader.go index 3ded3e5e..b5164eb0 100644 --- a/index/rolodex_file_loader.go +++ b/index/rolodex_file_loader.go @@ -15,8 +15,8 @@ import ( "time" "github.com/pb33f/libopenapi/datamodel" - "golang.org/x/sync/syncmap" "gopkg.in/yaml.v3" + "sync" ) // LocalFS is a file system that indexes local files. @@ -25,12 +25,12 @@ type LocalFS struct { indexConfig *SpecIndexConfig entryPointDirectory string baseDirectory string - Files syncmap.Map + Files sync.Map extractedFiles map[string]RolodexFile logger *slog.Logger readingErrors []error rolodex *Rolodex - processingFiles syncmap.Map + processingFiles sync.Map } // GetFiles returns the files that have been indexed. A map of RolodexFile objects keyed by the full path of the file. diff --git a/index/rolodex_remote_loader.go b/index/rolodex_remote_loader.go index 7d109c04..ab6a8e65 100644 --- a/index/rolodex_remote_loader.go +++ b/index/rolodex_remote_loader.go @@ -18,8 +18,8 @@ import ( "github.com/pb33f/libopenapi/datamodel" "github.com/pb33f/libopenapi/utils" - "golang.org/x/sync/syncmap" "gopkg.in/yaml.v3" + "sync" ) const ( @@ -38,8 +38,8 @@ type RemoteFS struct { rootURL string rootURLParsed *url.URL RemoteHandlerFunc utils.RemoteURLHandler - Files syncmap.Map - ProcessingFiles syncmap.Map + Files sync.Map + ProcessingFiles sync.Map FetchTime int64 FetchChannel chan *RemoteFile remoteErrors []error @@ -344,10 +344,10 @@ func (i *RemoteFS) Open(remoteURL string) (fs.File, error) { remoteParsedURL.Host = i.rootURLParsed.Host remoteParsedURL.Scheme = i.rootURLParsed.Scheme // this has been disabled, because I don't think it has value, it causes more problems than it solves currently. - //if !strings.HasPrefix(remoteParsedURL.Path, "/") { + // if !strings.HasPrefix(remoteParsedURL.Path, "/") { // remoteParsedURL.Path = filepath.Join(i.rootURLParsed.Path, remoteParsedURL.Path) // remoteParsedURL.Path = strings.ReplaceAll(remoteParsedURL.Path, "\\", "/") - //} + // } } if remoteParsedURL.Scheme == "" { diff --git a/index/spec_index.go b/index/spec_index.go index 75cbcda5..7a74222f 100644 --- a/index/spec_index.go +++ b/index/spec_index.go @@ -22,7 +22,6 @@ import ( "github.com/pb33f/libopenapi/utils" "github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath" - "golang.org/x/sync/syncmap" "gopkg.in/yaml.v3" ) @@ -73,7 +72,7 @@ func createNewIndex(rootNode *yaml.Node, index *SpecIndex, avoidBuildOut bool) * index.nodeMap = make(map[int]map[int]*yaml.Node) go index.MapNodes(rootNode) // this can run async. - index.cache = new(syncmap.Map) + index.cache = new(sync.Map) // boot index. results := index.ExtractRefs(index.root.Content[0], index.root, []string{}, 0, false, "") diff --git a/index/spec_index_test.go b/index/spec_index_test.go index 062f8699..3bf333c6 100644 --- a/index/spec_index_test.go +++ b/index/spec_index_test.go @@ -19,10 +19,9 @@ import ( "time" "github.com/pb33f/libopenapi/utils" - "golang.org/x/sync/syncmap" - "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" + "sync" ) const ( @@ -44,7 +43,7 @@ func TestSpecIndex_GetCache(t *testing.T) { assert.True(t, ok) // create a new cache - newCache := new(syncmap.Map) + newCache := new(sync.Map) index.SetCache(newCache) // check that the cache has been set. diff --git a/renderer/schema_renderer.go b/renderer/schema_renderer.go index 7ceebb99..e4d62b73 100644 --- a/renderer/schema_renderer.go +++ b/renderer/schema_renderer.go @@ -16,7 +16,7 @@ import ( "github.com/lucasjones/reggen" "github.com/pb33f/libopenapi/datamodel/high/base" "github.com/pb33f/libopenapi/orderedmap" - "golang.org/x/exp/slices" + "slices" ) const ( diff --git a/what-changed/model/schema.go b/what-changed/model/schema.go index 0c481deb..ad7061c4 100644 --- a/what-changed/model/schema.go +++ b/what-changed/model/schema.go @@ -8,7 +8,7 @@ import ( "sort" "sync" - "golang.org/x/exp/slices" + "slices" "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/base"