Coder Social home page Coder Social logo

Comments (8)

ploxiln avatar ploxiln commented on July 19, 2024

the issue is that #92 updated the version of github.com/mreiferson/go-options being used

from oauth2-proxy.

Berjou avatar Berjou commented on July 19, 2024

Indeed. This is the exact commit that cause the issue: mreiferson/go-options@0c63f02.
* use Get() rather than String() for flag values

from oauth2-proxy.

Berjou avatar Berjou commented on July 19, 2024

The panic is raised line 86 of https://github.com/mreiferson/go-options/blob/master/options.go:

v = flagInst.Value.String() -> v = flagInst.Value.(flag.Getter).Get()

However, flagInst.Value does not implement the Getter interface. I'm completely inexperimented in Go, but for my understanding, the problem here is that in https://github.com/pusher/oauth2_proxy/blob/master/main.go, we have

emailDomains := StringArray{}
whitelistDomains := StringArray{}
upstreams := StringArray{}
skipAuthRegex := StringArray{}
googleGroups := StringArray{}

and then, we pass these variables to flagSet.Var(), but a StringArray() does not implement the Getter interface.

from oauth2-proxy.

ploxiln avatar ploxiln commented on July 19, 2024

That is correct, a Get() method needs to be added for the StringArray type

from oauth2-proxy.

flowstate avatar flowstate commented on July 19, 2024

I added a Get() to StringArray and it still failed exactly the same way:

// StringArray is a type alias for a slice of strings
type StringArray []string

// Set appends a string to the StringArray
func (a *StringArray) Set(s string) error {
	*a = append(*a, s)
	return nil
}

// String joins elements of the StringArray into a single comma separated string
func (a *StringArray) String() string {
	return strings.Join(*a, ",")
}

func (a *StringArray) Get() string {
	return strings.Join(*a, ",")
}

However, my go is very rusty, so I could be missing a reason this fails.

from oauth2-proxy.

ploxiln avatar ploxiln commented on July 19, 2024

Get() needs to return interface{} explicitly.

There is actually another project with the same type and usage which adapted for this first:
https://github.com/nsqio/nsq/blob/master/internal/app/string_array.go

from oauth2-proxy.

Berjou avatar Berjou commented on July 19, 2024

I have just tested the latest docker image, this issue seems to be solved.

from oauth2-proxy.

JoelSpeed avatar JoelSpeed commented on July 19, 2024

Thanks 😀

from oauth2-proxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.