diff --git a/docs/pages/licenses/devpod.mdx b/docs/pages/licenses/devpod.mdx index 9cd8fb4f2..76cd7b3aa 100644 --- a/docs/pages/licenses/devpod.mdx +++ b/docs/pages/licenses/devpod.mdx @@ -201,8 +201,8 @@ Some packages may only be included on certain architectures or operating systems - [github.com/spf13/pflag](https://pkg.go.dev/github.com/spf13/pflag) ([BSD-3-Clause](https://github.com/skevetter/devpod/blob/HEAD/vendor/github.com/spf13/pflag/LICENSE)) - [github.com/stoewer/go-strcase](https://pkg.go.dev/github.com/stoewer/go-strcase) ([MIT](https://github.com/skevetter/devpod/blob/HEAD/vendor/github.com/stoewer/go-strcase/LICENSE)) - [github.com/takama/daemon](https://pkg.go.dev/github.com/takama/daemon) ([MIT](https://github.com/skevetter/devpod/blob/HEAD/vendor/github.com/takama/daemon/LICENSE)) + - [github.com/tailscale/hujson](https://pkg.go.dev/github.com/tailscale/hujson) ([BSD-3-Clause](https://github.com/skevetter/devpod/blob/HEAD/vendor/github.com/tailscale/hujson/LICENSE)) - [github.com/tcnksm/go-gitconfig](https://pkg.go.dev/github.com/tcnksm/go-gitconfig) ([MIT](https://github.com/skevetter/devpod/blob/HEAD/vendor/github.com/tcnksm/go-gitconfig/LICENSE)) - - [github.com/tidwall/jsonc](https://pkg.go.dev/github.com/tidwall/jsonc) ([MIT](https://github.com/skevetter/devpod/blob/HEAD/vendor/github.com/tidwall/jsonc/LICENSE)) - [github.com/tonistiigi/fsutil](https://pkg.go.dev/github.com/tonistiigi/fsutil) ([MIT](https://github.com/skevetter/devpod/blob/HEAD/vendor/github.com/tonistiigi/fsutil/LICENSE)) - [github.com/tonistiigi/go-csvvalue](https://pkg.go.dev/github.com/tonistiigi/go-csvvalue) ([MIT](https://github.com/skevetter/devpod/blob/HEAD/vendor/github.com/tonistiigi/go-csvvalue/LICENSE)) - [github.com/tonistiigi/units](https://pkg.go.dev/github.com/tonistiigi/units) ([MIT](https://github.com/skevetter/devpod/blob/HEAD/vendor/github.com/tonistiigi/units/LICENSE)) diff --git a/go.mod b/go.mod index 7e7cff577..abbd8b54c 100644 --- a/go.mod +++ b/go.mod @@ -57,8 +57,8 @@ require ( github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 github.com/stretchr/testify v1.11.1 + github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a github.com/takama/daemon v1.0.0 - github.com/tidwall/jsonc v0.3.3 github.com/tonistiigi/fsutil v0.0.0-20251211185533-a2aa163d723f github.com/u-root/u-root v0.16.0 go.uber.org/atomic v1.11.0 @@ -272,7 +272,6 @@ require ( github.com/tailscale/certstore v0.1.1-0.20231202035212-d3fa0460f47e // indirect github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 // indirect github.com/tailscale/goupnp v1.0.1-0.20210804011211-c64d0f06ea05 // indirect - github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a // indirect github.com/tailscale/peercred v0.0.0-20250107143737-35a0c7bd7edc // indirect github.com/tailscale/web-client-prebuilt v0.0.0-20250124233751-d4cd19a26976 // indirect github.com/tailscale/wireguard-go v0.0.0-20250716170648-1d0488a3d7da // indirect diff --git a/go.sum b/go.sum index fd5d37988..967fde201 100644 --- a/go.sum +++ b/go.sum @@ -716,8 +716,6 @@ github.com/tc-hib/winres v0.2.1 h1:YDE0FiP0VmtRaDn7+aaChp1KiF4owBiJa5l964l5ujA= github.com/tc-hib/winres v0.2.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/jsonc v0.3.3 h1:RVQqL3xFfDkKKXIDsrBiVQiEpBtxoKbmMXONb2H/y2w= -github.com/tidwall/jsonc v0.3.3/go.mod h1:dw+3CIxqHi+t8eFSpzzMlcVYxKp08UP5CD8/uSFCyJE= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= diff --git a/pkg/devcontainer/config/parse.go b/pkg/devcontainer/config/parse.go index 7b88d3461..012e6acdb 100644 --- a/pkg/devcontainer/config/parse.go +++ b/pkg/devcontainer/config/parse.go @@ -11,7 +11,7 @@ import ( "unicode/utf8" doublestar "github.com/bmatcuk/doublestar/v4" - "github.com/tidwall/jsonc" + "github.com/tailscale/hujson" ) const DEVCONTAINER_FEATURE_FILE_NAME = "devcontainer-feature.json" @@ -34,7 +34,11 @@ func ParseDevContainerFeature(folder string) (*FeatureConfig, error) { } featureConfig := &FeatureConfig{} - err = json.Unmarshal(jsonc.ToJSON(data), featureConfig) + normalized, err := hujson.Standardize(data) + if err != nil { + return nil, fmt.Errorf("parse jsonc: %w", err) + } + err = json.Unmarshal(normalized, featureConfig) if err != nil { return nil, err } @@ -82,7 +86,11 @@ func ParseDevContainerJSONFile(jsonFilePath string) (*DevContainerConfig, error) } devContainer := &DevContainerConfig{} - err = json.Unmarshal(jsonc.ToJSON(bytes), devContainer) + normalized, err := hujson.Standardize(bytes) + if err != nil { + return nil, fmt.Errorf("parse jsonc: %w", err) + } + err = json.Unmarshal(normalized, devContainer) if err != nil { return nil, err }