refactor: remove duplicate toml library

This commit is contained in:
Jan De Dobbeleer 2024-03-12 09:38:58 +01:00 committed by Jan De Dobbeleer
parent fd095c80a9
commit b38df39fd2
3 changed files with 4 additions and 7 deletions

View file

@ -46,7 +46,6 @@ require (
)
require (
github.com/BurntSushi/toml v1.3.2
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect

View file

@ -2,8 +2,6 @@ dmitri.shuralyov.com/font/woff2 v0.0.0-20180220214647-957792cbbdab h1:Ew70NL+wL6
dmitri.shuralyov.com/font/woff2 v0.0.0-20180220214647-957792cbbdab/go.mod h1:FvHgTMJanm43G7B3MVSjS/jim5ytVqAJNAOpRhnuHJc=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732 h1:0EDePskeF4vNFCk70ATaFHQzjmwXsk+VImnMJttecNU=
github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732/go.mod h1:krTLO7JWu6g8RMxG8sl+T1Hf8W93XQacBKJmqFZ2MFY=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=

View file

@ -12,7 +12,7 @@ import (
"github.com/jandedobbeleer/oh-my-posh/src/regex"
"golang.org/x/exp/slices"
"github.com/BurntSushi/toml"
toml "github.com/pelletier/go-toml/v2"
)
type ProjectItem struct {
@ -154,7 +154,7 @@ func (n *Project) getCargoPackage(item ProjectItem) *ProjectData {
content := n.env.FileContent(item.Files[0])
var data CargoTOML
_, err := toml.Decode(content, &data)
err := toml.Unmarshal([]byte(content), &data)
if err != nil {
n.Error = err.Error()
return nil
@ -170,7 +170,7 @@ func (n *Project) getPythonPackage(item ProjectItem) *ProjectData {
content := n.env.FileContent(item.Files[0])
var data PyProjectTOML
_, err := toml.Decode(content, &data)
err := toml.Unmarshal([]byte(content), &data)
if err != nil {
n.Error = err.Error()
return nil
@ -293,7 +293,7 @@ func (n *Project) getProjectData(item ProjectItem) *ProjectData {
content := n.env.FileContent(item.Files[0])
var data ProjectData
_, err := toml.Decode(content, &data)
err := toml.Unmarshal([]byte(content), &data)
if err != nil {
n.Error = err.Error()
return nil