weldr: update our use of BurntSushi/toml

The old method is deprecated and failing the linter.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2022-04-07 20:07:29 +02:00 committed by Alexander Todorov
parent 32f3d3d66e
commit a3c207945f
2 changed files with 4 additions and 4 deletions

View file

@ -1902,7 +1902,7 @@ func (api *API) blueprintsNewHandler(writer http.ResponseWriter, request *http.R
if contentType[0] == "application/json" {
err = json.NewDecoder(request.Body).Decode(&blueprint)
} else if contentType[0] == "text/x-toml" {
_, err = toml.DecodeReader(request.Body, &blueprint)
_, err = toml.NewDecoder(request.Body).Decode(&blueprint)
} else {
err = errors_package.New("blueprint must be in json or toml format")
}
@ -1975,7 +1975,7 @@ func (api *API) blueprintsWorkspaceHandler(writer http.ResponseWriter, request *
if contentType[0] == "application/json" {
err = json.NewDecoder(request.Body).Decode(&blueprint)
} else if contentType[0] == "text/x-toml" {
_, err = toml.DecodeReader(request.Body, &blueprint)
_, err = toml.NewDecoder(request.Body).Decode(&blueprint)
} else {
err = errors_package.New("blueprint must be in json or toml format")
}

View file

@ -326,7 +326,7 @@ func TestBlueprintsInfoToml(t *testing.T) {
require.Equal(t, http.StatusOK, resp.StatusCode)
var got blueprint.Blueprint
_, err := toml.DecodeReader(resp.Body, &got)
_, err := toml.NewDecoder(resp.Body).Decode(&got)
require.NoErrorf(t, err, "error decoding toml file")
expected := blueprint.Blueprint{
@ -1381,7 +1381,7 @@ func TestSourcesInfoToml(t *testing.T) {
resp := recorder.Result()
var sources map[string]store.SourceConfig
_, err := toml.DecodeReader(resp.Body, &sources)
_, err := toml.NewDecoder(resp.Body).Decode(&sources)
require.NoErrorf(t, err, "error decoding toml file")
expected := map[string]store.SourceConfig{