Skip to content

Commit

Permalink
less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbalex committed Aug 22, 2019
1 parent c5f3e85 commit 7a67d71
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ import (
publiccode "github.com/italia/publiccode-parser-go"
)

//Enc encoder struct which includes essential datatypes
type Enc struct {
PublicCode publiccode.PublicCode
}

//Message json type mapping, for test purpose
type Message struct {
Status string `json:"status"`
Expand Down Expand Up @@ -65,9 +60,6 @@ func getURLFromYMLBuffer(in []byte) *url.URL {
// getRawURL returns a valid raw root repository based on
// major code hosting platforms
func getRawURL(url *url.URL) string {
log.Printf("repo url: %s", url)
// url = vcsurl.GetRawFile(url)
log.Printf("repo url: %s", url)
return vcsurl.GetRawRoot(url).String()
}

Expand Down Expand Up @@ -121,10 +113,8 @@ func validate(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusBadRequest)
json.NewEncoder(w).Encode(mess)
}
log.Print("CT json", string(m))
} else {
m = body
log.Print("CT yaml: ", string(m), err)
}

//parsing
Expand Down Expand Up @@ -161,22 +151,3 @@ func yaml2json(y []byte) []byte {
}
return r
}

// json2yaml json to yaml conversion
func (d *Enc) json2yaml() []byte {
log.Print(d.PublicCode)
m, err := yaml.Marshal(d.PublicCode)
// log.Print(string(m))
if err != nil {
log.Printf("Marshall to yaml ko:\n%v\n", err)
// return
}

r, err := yaml.JSONToYAML(m)
// log.Print(string(r))
if err != nil {
log.Printf("Conversion to yaml ko:\n%v\n", err)
// return
}
return r
}

0 comments on commit 7a67d71

Please sign in to comment.