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

Structs in cmd folder should be visible to other programs. #114

Open
chillyvee opened this issue Oct 19, 2022 · 1 comment
Open

Structs in cmd folder should be visible to other programs. #114

chillyvee opened this issue Oct 19, 2022 · 1 comment

Comments

@chillyvee
Copy link
Contributor

chillyvee commented Oct 19, 2022

There are many types defined in the cmd/horcrux/cmd directory which can't be integrated into other programs.

For example:
https://github.com/strangelove-ventures/horcrux/blob/main/cmd/horcrux/cmd/config.go#L543

type CosignerConfig struct {
	Threshold int            `json:"threshold"   yaml:"threshold"`
	Shares    int            `json:"shares" yaml:"shares"`
	P2PListen string         `json:"p2p-listen"  yaml:"p2p-listen"`
	Peers     []CosignerPeer `json:"peers"       yaml:"peers"`
	Timeout   string         `json:"rpc-timeout" yaml:"rpc-timeout"`
}

Can't be referenced from a third party program.

For example we had to recreate the same struct in our program in order to utilize the same structures.
https://github.com/chillyvee/precrux/blob/master/snitch/generate.go#L22

Is it acceptable to extract all these types into https://github.com/strangelove-ventures/horcrux/horcrux/types.go

Or something else like that?

If so we can start to work on a PR. Guidance is welcome.

@agouin
Copy link
Member

agouin commented Nov 13, 2022

@chillyvee yes, moving these types into a public package would be fine!

@jonathanpberger jonathanpberger changed the title Structs in cmd folder are invisible to other programs Structs in cmd folder should be visible to other programs. Mar 21, 2023
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