daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main
  2.  
  3. import (
  4.     "log"
  5.     "golang.org/x/net/context"
  6.     firebase "firebase.google.com/go"
  7.     "google.golang.org/api/option"
  8.     "github.com/gorilla/mux"
  9.     "net/http"
  10.     "time"
  11. )
  12.  
  13. func main() {
  14.     port := ":5000"
  15.     rtr := mux.NewRouter()
  16.  
  17.     sa := option.WithCredentialsFile("./credfile.json")
  18.     ctx := context.Background()
  19.     app, err := firebase.NewApp(ctx, nil, sa)
  20.     if err != nil {
  21.         log.Fatalf("error initializing app: %vn", err)
  22.     }
  23.  
  24.     client, err := app.Firestore(ctx)
  25.     if err != nil {
  26.         log.Fatalln(err)
  27.     }
  28.     defer client.Close()
  29.  
  30.     server := &http.Server{
  31.         Addr: port,
  32.         Handler: rtr,
  33.         ReadTimeout: 5 * time.Second,
  34.         WriteTimeout: 10 * time.Second,
  35.     }
  36.  
  37.     log.Fatal(server.ListenAndServe())
  38. }
  39.    
  40. ../../../../go/src/golang.org/x/oauth2/google/default.go:20:2: code in directory /Users/username/go/src/google.golang.org/cloud/compute/metadata expects import "cloud.google.com/go/compute/metadata"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top