Skip to content

generator: --include doesn't support external package(s) ? #179

@iurii-ssv

Description

@iurii-ssv

Perhaps I'm using it wrong (there isn't a proper example for it though), but when doing something like

import (
    spectypes "github.com/ssvlabs/ssv-spec/types"
)

//go:generate sszgen -path ./shares.go --objs storageShare --include github.com/ssvlabs/ssv-spec/types

type storageShare struct {
	OperatorID spectypes.OperatorID // uint64 essentially
}

I get the following error running sszgen:

[ERR]: stat github.com/ssvlabs/ssv-spec/types: no such file or directory
shares.go:18: running "sszgen": exit status 1

I've tried different ways to reference this external package (using alias and whatnot) but result is the same.


Additionally, if I try embedding - the error would be long the following lines:

[ERR]: failed to encode storageShare: embed type expects a typed object in same package but *ast.SelectorExpr found
shares.go:18: running "sszgen": exit status 1

which kind of suggest that external packages aren't supported at all (if they are supported, why not for embedding).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions