bitly / oauth2_proxy

A reverse proxy that provides authentication with Google, Github or other provider
MIT License
5.1k stars 1.21k forks source link

Building oauth2_proxy #592

Closed jgn closed 6 years ago

jgn commented 6 years ago

@ploxiln suggests for building:

  1. install the "dep" tool from https://github.com/golang/dep (download a stand-alone binary from Releases, put it somewhere in your PATH e.g. /usr/local/bin/, name it dep, make it executable)
  2. checkout the oauth2_proxy repo into your GOPATH, e.g. git clone https://github.com/bitly/oauth2_proxy $HOME/go/src/github.com/bitly/oauth2_proxy
  3. cd into that repo
  4. run dep ensure
  5. run go build
  6. the result is a single stand-alone binary named oauth2_proxy

But there seem to be issues with the dependencies on a pretty vanilla go environment:

$ # cloned to $HOME/src/oauth2_proxy
$ export GOPATH=$HOME
$ cd $GOPATH/src/oauth2_proxy
$ dep ensure
Warning: the following project(s) have [[constraint]] stanzas in Gopkg.toml:

  ✗  github.com/18F/hmacauth

However, these projects are not direct dependencies of the current project:
they are not imported in any .go files, nor are they in the 'required' list in
Gopkg.toml. Dep only applies [[constraint]] rules to direct dependencies, so
these rules will have no effect.

Either import/require packages from these projects so that they become direct
dependencies, or convert each [[constraint]] to an [[override]] to enforce rules
on these projects, if they happen to be transitive dependencies,

Solving failure: No versions of gopkg.in/fsnotify.v1 met constraints:
    v1.2.11: unable to update checked out version: fatal: reference is not a tree: 836bfd95fecc0f1511dd66bdbf2b5b61ab8b00b6
: command failed: [git checkout 836bfd95fecc0f1511dd66bdbf2b5b61ab8b00b6]: exit status 128
jgn commented 6 years ago

A colleague @wm notes: https://github.com/go-fsnotify/fsnotify and "Change your dependencies from github.com/go-fsnotify/fsnotify to github.com/fsnotify/fsnotify"

jgn commented 6 years ago

Alright . . . that seems to have compiled and accepts the newer options (--provider oidc, --oidc-issuer-url)

jgn commented 6 years ago
$ git diff origin/master
diff --git a/Gopkg.lock b/Gopkg.lock
index 5a3758a..1294a90 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -131,7 +131,7 @@
   version = "v1.0.0"

 [[projects]]
-  name = "gopkg.in/fsnotify.v1"
+  name = "gopkg.in/fsnotify/fsnotify.v1"
   packages = ["."]
   revision = "836bfd95fecc0f1511dd66bdbf2b5b61ab8b00b6"
   version = "v1.2.11"
@@ -149,6 +149,6 @@
 [solve-meta]
   analyzer-name = "dep"
   analyzer-version = 1
-  inputs-digest = "b502c41a61115d14d6379be26b0300f65d173bdad852f0170d387ebf2d7ec173"
+  inputs-digest = "cfdd05348394cd0597edb858bdba5681665358a963356ed248d98f39373c33b5"
   solver-name = "gps-cdcl"
   solver-version = 1
diff --git a/Gopkg.toml b/Gopkg.toml
index c4005e1..422bd43 100644
--- a/Gopkg.toml
+++ b/Gopkg.toml
@@ -4,7 +4,7 @@
 #

 [[constraint]]
-  name = "github.com/18F/hmacauth"
+  name = "github.com/mbland/hmacauth"
   version = "~1.0.1"

 [[constraint]]
@@ -36,7 +36,7 @@
   name = "google.golang.org/api"

 [[constraint]]
-  name = "gopkg.in/fsnotify.v1"
+  name = "gopkg.in/fsnotify/fsnotify.v1"
   version = "~1.2.0"

 [[constraint]]
diff --git a/watcher.go b/watcher.go
index bedb9f8..9888fe5 100644
--- a/watcher.go
+++ b/watcher.go
@@ -8,7 +8,7 @@ import (
        "path/filepath"
        "time"

-       "gopkg.in/fsnotify.v1"
+       "gopkg.in/fsnotify/fsnotify.v1"
 )

 func WaitForReplacement(filename string, op fsnotify.Op,
sporkmonger commented 6 years ago

Should this have been closed?

kautsig commented 6 years ago

Nope, don't think so. Just bumped into the same issue. The diff provided by @jgn works though. See PR above.