Recovering operational
parent
ac8771aac4
commit
cfb43ba21d
1
go.mod
1
go.mod
|
@ -5,7 +5,6 @@ go 1.17
|
||||||
require (
|
require (
|
||||||
github.com/alecthomas/kong v0.2.15
|
github.com/alecthomas/kong v0.2.15
|
||||||
github.com/fatih/structtag v1.2.0
|
github.com/fatih/structtag v1.2.0
|
||||||
github.com/gin-gonic/gin v1.6.3
|
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
package lib
|
|
||||||
|
|
||||||
//type Config struct {
|
|
||||||
// Gofname string `yaml:"gofname"`
|
|
||||||
// Goimpldir string `yaml:"goimpldir"`
|
|
||||||
// Tsfname string `json:"tsfname"`
|
|
||||||
// Goclifname string `json:"goclifname"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//var config Config
|
|
||||||
//
|
|
||||||
//func loadConfig() {
|
|
||||||
// fname := flag.String("f", ".apigen.yaml", "File with config to load - defaults to '.apigen'")
|
|
||||||
// flag.Parse()
|
|
||||||
// bs, err := ioutil.ReadFile(*fname)
|
|
||||||
// Err(err)
|
|
||||||
// err = yaml.Unmarshal(bs, &config)
|
|
||||||
// Err(err)
|
|
||||||
//}
|
|
|
@ -112,10 +112,4 @@ func Run() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
//loadConfig()
|
|
||||||
//
|
|
||||||
|
|
||||||
//os.Remove(config.Gofname)
|
|
||||||
|
|
||||||
//process(&api)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ func invoke(m string, path string, bodyo interface{}) (*json.Decoder, error) {
|
||||||
for k, v := range api.Methods {
|
for k, v := range api.Methods {
|
||||||
WNL(`func %s(req %s) (res %s, err error){`, k, ResDecType(v.ReqType), ResDecType(v.ResType))
|
WNL(`func %s(req %s) (res %s, err error){`, k, ResDecType(v.ReqType), ResDecType(v.ResType))
|
||||||
WNL(` var dec *json.Decoder
|
WNL(` var dec *json.Decoder
|
||||||
dec, err = invoke("%s", "%s", res)
|
dec, err = invoke("%s", "%s", req)
|
||||||
if err!=nil{
|
if err!=nil{
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,15 +64,15 @@ func processGoServerOutput(f string) error {
|
||||||
|
|
||||||
WNL(` default:
|
WNL(` default:
|
||||||
http.Error(w,"Method not allowed",500)`)
|
http.Error(w,"Method not allowed",500)`)
|
||||||
|
|
||||||
|
WNL(` }`)
|
||||||
}
|
}
|
||||||
|
WNL(` })`)
|
||||||
WNL(` }`)
|
|
||||||
|
|
||||||
WNL(` })
|
|
||||||
return ret
|
|
||||||
}`)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
WNL(` return ret
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
for _, v := range api.Methods {
|
for _, v := range api.Methods {
|
||||||
WNL(`func h_%s(w http.ResponseWriter, r *http.Request) {
|
WNL(`func h_%s(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
Loading…
Reference in New Issue