google app engine - Builds at commandline but fails to build as gae app -


no issues building @ commandline:

darians-macbook-pro:gdriveweb darianhickman$ go build helloworld/hello.go

darians-macbook-pro:gdriveweb darianhickman$

error @ locahost:8080/

the go application not built.

(executed command: /users/darianhickman/go_appengine/goroot/bin/go-app-builder -app_base /users/darianhickman/gowork/src/bitbucket.org/darian_hickman/gdriveweb/helloworld -arch 6 -dynamic -goroot /users/darianhickman/go_appengine/goroot -nobuild_files ^^$ -unsafe -gopath /users/darianhickman/gowork -binary_name _go_app -extra_imports appengine_internal/init -work_dir /var/folders/fk/wknp5jzn53gbgbml0yn695_m0000gn/t/tmpshfp6tappengine-go-bin -gcflags -i,/users/darianhickman/go_appengine/goroot/pkg/darwin_amd64_appengine -ldflags -l,/users/darianhickman/go_appengine/goroot/pkg/darwin_amd64_appengine hello.go) /users/darianhickman/gowork/src/golang.org/x/net/context/ctxhttp/ctxhttp.go:35: req.cancel undefined (type *http.request has no field or method cancel)

2016/05/24 19:39:17 go-app-builder: build timing: 6×6g (469ms total), 0×6l (0 total) 2016/05/24 19:39:17 go-app-builder: failed running 6g: exit status 1

when research error

*http.request has no field or method cancel

it leads bunch of nonapplicable posts updating >go1.5.

source:

 package hello  import (     "encoding/json"     "fmt"     "golang.org/x/net/context"     "golang.org/x/oauth2"     "golang.org/x/oauth2/google"     "google.golang.org/api/drive/v3"     _ "google.golang.org/appengine/urlfetch"     "io/ioutil"     "log"     "net/http"     "net/url"     "os"     "os/user"     "path/filepath" )  const (     assetfolder = "0b-zdryej60u_mxvkajfwexbqwhm" )  var (     dir *drive.filelist )  func init() {     http.handlefunc("/", handler)      ctx := context.background()      b, err := ioutil.readfile("client_secret.json")     if err != nil {         log.fatalf("unable read client secret file: %v", err)     }      // if modifying these scopes, delete saved credentials     // @ ~/.credentials/drive-go-quickstart.json     config, err := google.configfromjson(b, drive.drivemetadatareadonlyscope)     if err != nil {         log.fatalf("unable parse client secret file config: %v", err)     }     client := getclient(ctx, config)      srv, err := drive.new(client)     if err != nil {         log.fatalf("unable retrieve drive client %v", err)     }      dir, err = srv.files.list().pagesize(10).         fields("nextpagetoken, files(id, name)").do()     if err != nil {         log.fatalf("unable retrieve files.", err)     }  }  func handler(w http.responsewriter, r *http.request) {      //fmt.fprint(w, r.requesturi)      fmt.fprint(w, "files:")     if len(dir.files) > 0 {         _, := range dir.files {             fmt.fprint(w, "%s (%s)\n", i.name, i.id)         }     } else {         fmt.fprint(w, "no files found.")     } }  // getclient uses context , config retrieve token // generate client. returns generated client. func getclient(ctx context.context, config *oauth2.config) *http.client {     cachefile, err := tokencachefile()     if err != nil {         log.fatalf("unable path cached credential file. %v", err)     }     tok, err := tokenfromfile(cachefile)     if err != nil {         tok = gettokenfromweb(config)         savetoken(cachefile, tok)     }     return config.client(ctx, tok) }  // gettokenfromweb uses config request token. // returns retrieved token. func gettokenfromweb(config *oauth2.config) *oauth2.token {     authurl := config.authcodeurl("state-token", oauth2.accesstypeoffline)     fmt.printf("go following link in browser type "+         "authorization code: \n%v\n", authurl)      var code string     if _, err := fmt.scan(&code); err != nil {         log.fatalf("unable read authorization code %v", err)     }      tok, err := config.exchange(oauth2.nocontext, code)     if err != nil {         log.fatalf("unable retrieve token web %v", err)     }     return tok }  // tokencachefile generates credential file path/filename. // returns generated credential path/filename. func tokencachefile() (string, error) {     usr, err := user.current()     if err != nil {         return "", err     }     tokencachedir := filepath.join(usr.homedir, ".credentials")     os.mkdirall(tokencachedir, 0700)     return filepath.join(tokencachedir,         url.queryescape("drive-go-quickstart.json")), err }  // tokenfromfile retrieves token given file path. // returns retrieved token , read error encountered. func tokenfromfile(file string) (*oauth2.token, error) {     f, err := os.open(file)     if err != nil {         return nil, err     }     t := &oauth2.token{}     err = json.newdecoder(f).decode(t)     defer f.close()     return t, err }  // savetoken uses file path create file , store // token in it. func savetoken(file string, token *oauth2.token) {     fmt.printf("saving credential file to: %s\n", file)     f, err := os.create(file)     if err != nil {         log.fatalf("unable cache oauth token: %v", err)     }     defer f.close()     json.newencoder(f).encode(token) }  func main() {     ctx := context.background()      b, err := ioutil.readfile("client_secret.json")     if err != nil {         log.fatalf("unable read client secret file: %v", err)     }      // if modifying these scopes, delete saved credentials     // @ ~/.credentials/drive-go-quickstart.json     config, err := google.configfromjson(b, drive.drivemetadatareadonlyscope)     if err != nil {         log.fatalf("unable parse client secret file config: %v", err)     }     client := getclient(ctx, config)      srv, err := drive.new(client)     if err != nil {         log.fatalf("unable retrieve drive client %v", err)     }      r, err := srv.files.list().pagesize(10).         fields("nextpagetoken, files(id, name)").do()     if err != nil {         log.fatalf("unable retrieve files.", err)     }      fmt.println("files:")     if len(r.files) > 0 {         _, := range r.files {             fmt.printf("%s (%s)\n", i.name, i.id)         }     } else {         fmt.print("no files found.")     }  } 

i got past issue redownloading , reinstalling go app engine sdk . best guess why worked old version of go somehow getting included.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -