Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do i use other flag parse tools ,like kingpin🤔 #159

Closed
dominicqi opened this issue Feb 20, 2020 · 7 comments
Closed

How do i use other flag parse tools ,like kingpin🤔 #159

dominicqi opened this issue Feb 20, 2020 · 7 comments

Comments

@dominicqi
Copy link

dominicqi commented Feb 20, 2020

Question description
fiber.New() calls flag.Parse 。but when i use kingpin,they are in conflict.
i think the fiber.New() may should not call flag.Parse() . What do you think?
Could there be another solution?Sorry, I'm new to golang.
Code snippet (optional)

package main

import (
	"github.com/gofiber/fiber"
	"gopkg.in/alecthomas/kingpin.v2"
	"os"
)

func main()  {
	var testFlag string
	application := kingpin.New("demo", "demo")
	application.Flag("test","kinping flag").Default("test").StringVar(&testFlag)
	application.Parse(os.Args[1:])
	server := fiber.New()
	server.Listen(8080)
}
@welcome
Copy link

welcome bot commented Feb 20, 2020

Thanks for opening your first issue here! 🎉 Be sure to follow the issue template!

@dominicqi dominicqi changed the title How do i user other flag parse tools ,like kingpin🤔 How do i use other flag parse tools ,like kingpin🤔 Feb 20, 2020
@Fenny
Copy link
Member

Fenny commented Feb 20, 2020

Fiber and other frameworks rely on flag.Parse. This problem could be on Kingpins end. Does it relate to this issue alecthomas/kingpin#194?

If you could provide an error log, we might be able to help out.

@dominicqi
Copy link
Author

Fiber and other frameworks rely on flag.Parse. This problem could be on Kingpins end. Does it relate to this issue alecthomas/kingpin#194?

If you could provide an error log, we might be able to help out.

I edit the code snippet. if no flag set the server start success. but if i start with flag
./test --test=kingpin flag provided but not defined: -test Usage of ./test: -child is child process -prefork use prefork

@dominicqi
Copy link
Author

I'm a little confused why prefork and child setting by flag? why not like other parameters like 'Banner' or 'Engine.xxx'. If someone use fiber , they have to set the flags,if they want change .It sounds a little strange.

@Fenny
Copy link
Member

Fenny commented Feb 21, 2020

@dominicqi I created a PR with a possible fix, could you try it again with the master branch?

@Fenny Fenny mentioned this issue Feb 21, 2020
@Fenny Fenny added the bug label Feb 21, 2020
@dominicqi
Copy link
Author

dominicqi commented Feb 21, 2020

@dominicqi I created a PR with a possible fix, could you try it again with the master branch?

It not work.
if flag.Lookup(name) == nil always be true.
Lookup find flag reg by flag.Var。

Could we simple remove this two flag ?

I means change to settings?

emm, i see the prefork func. can not remove this two flag

@Fenny
Copy link
Member

Fenny commented Feb 21, 2020

@dominicqi, we fixed this issue in v1.7.1
https://github.com/gofiber/fiber/releases/tag/v1.7.1

Could you update to latest version and tell me if it works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants