diff --git a/Makefile b/Makefile index 73ee15e..038ccbe 100644 --- a/Makefile +++ b/Makefile @@ -37,3 +37,22 @@ goDep.pb.go: goDep.proto repo.pb.go: repo.proto autogenpb --proto repo.proto + +protoc-bad: + cd ~/go/src && protoc \ + --proto_path=. \ + --proto_path=go.wit.com/lib/protobuf/gitpb \ + --go_out=. \ + --go_opt=Mgo.wit.com/lib/protobuf/gitpb/repo.proto=go.wit.com/lib/protobuf/gitpb \ + --go_opt=MgitTag.proto=go.wit.com/lib/protobuf/gitpb \ + --go_opt=MgoDep.proto=go.wit.com/lib/protobuf/gitpb \ + go.wit.com/lib/protobuf/gitpb/repo.proto + +protoc-good: + cd ~/go/src && protoc \ + --proto_path=. \ + --go_out=go.wit.com/lib/protobuf/gitpb \ + --go_opt=Mrepo.proto=go.wit.com/lib/protobuf/gitpb \ + --go_opt=MgitTag.proto=go.wit.com/lib/protobuf/gitpb \ + --go_opt=MgoDep.proto=go.wit.com/lib/protobuf/gitpb \ + go.wit.com/lib/protobuf/gitpb/repo.proto diff --git a/repo.http.go b/repo.http.go index d878dc0..794ee43 100644 --- a/repo.http.go +++ b/repo.http.go @@ -1,11 +1,7 @@ package gitpb import ( - "bytes" "net/http" - "net/url" - "os" - "os/user" "go.wit.com/lib/protobuf/httppb" "go.wit.com/log" @@ -27,7 +23,9 @@ func (p *Repos) SendReply(w http.ResponseWriter, reqPB *httppb.HttpRequest) erro return err } -func (p *Repos) HttpPost(baseURL string, route string) (*Repos, error) { +/* +// err handling here isn't great +func (p *Repos) HttpPost(baseURL string, route string) (*Repos, *httppb.HttpRequest, error) { // if you ever have "http://www.wit.com//" GO will regect the server recieving it. // Even though the linux kernel gets the network payload // also it never gives you an error about that, it just goes away invisably inside GO @@ -42,7 +40,7 @@ func (p *Repos) HttpPost(baseURL string, route string) (*Repos, error) { log.Info("reposs PB HttpPost", finalURL.String()) req, err = http.NewRequest(http.MethodPost, finalURL.String(), bytes.NewBuffer(data)) if req == nil { - return nil, err + return nil, nil, err } usr, _ := user.Current() @@ -52,9 +50,19 @@ func (p *Repos) HttpPost(baseURL string, route string) (*Repos, error) { newdata, err := httppb.PostReq(req) + reqPB, err2 := httppb.ReqToPB(req) + reqPB.URL = finalURL.String() + if err != nil { + reqPB.Errors = append(reqPB.Errors, fmt.Sprintf("%v", err)) + } + if err2 != nil { + reqPB.Errors = append(reqPB.Errors, fmt.Sprintf("%v", err2)) + } + newpb := NewRepos() err = newpb.Unmarshal(newdata) log.Infof("repos PB HttpPost %s sent len(%d) got len(%d)\n", finalURL.String(), p.Len(), newpb.Len()) - return newpb, err + return newpb, reqPB, err } +*/ diff --git a/repo.proto b/repo.proto index 1beea6c..18961d5 100644 --- a/repo.proto +++ b/repo.proto @@ -72,7 +72,7 @@ message Repo { // `autogenpb string DevelHash = 27; // hash of the current devel branch } -message Repos { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:gui` `autogenpb:nomutex` +message Repos { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:gui` `autogenpb:nomutex` `autogenpb:http` string uuid = 1; // `autogenpb:uuid:8daaeba1-fb1f-4762-ae6e-95a55d352673` string version = 2; // `autogenpb:version:v4` repeated Repo repos = 3; // `autogenpb:append` // generate AppendUnique() function for this