Documentation
¶
Index ¶
- func DumpNodeNoExit(whatever any)
- func DumpNodeWithExit(whatever any)
- func GetLocalSourcesPath() string
- func IsSemanticVersionGreaterOrEqualTo(versionStr string, version SemanticVersion) bool
- func IsSemanticVersionLowerOrEqualTo(versionStr string, version SemanticVersion) bool
- func Keccak256(data []byte) []byte
- func SimplifyImportPaths(content string) string
- func StripExtraSPDXLines(content string) string
- func StripImportPaths(content string) string
- func ToJSON(data any) ([]byte, error)
- func ToJSONPretty(data any) ([]byte, error)
- func ToProtoJSON(data any) ([]byte, error)
- func WriteToFile(path string, data []byte) error
- type NormalizationInfo
- type NormalizeType
- type SemanticVersion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DumpNodeNoExit ¶
func DumpNodeNoExit(whatever any)
DumpNodeNoExit prints a formatted JSON representation of the provided interface without exiting the program. This function is primarily used for debugging purposes.
func DumpNodeWithExit ¶
func DumpNodeWithExit(whatever any)
DumpNodeWithExit prints a formatted JSON representation of the provided interface and exits the program. This function is primarily used for debugging purposes.
func GetLocalSourcesPath ¶
func GetLocalSourcesPath() string
GetLocalSourcesPath returns the absolute path to the local sources directory.
func IsSemanticVersionGreaterOrEqualTo ¶ added in v0.3.1
func IsSemanticVersionGreaterOrEqualTo(versionStr string, version SemanticVersion) bool
IsSemanticVersionGreaterOrEqualTo checks if the version represented by the string is greater than or equal to the provided SemanticVersion.
func IsSemanticVersionLowerOrEqualTo ¶ added in v0.3.1
func IsSemanticVersionLowerOrEqualTo(versionStr string, version SemanticVersion) bool
IsSemanticVersionLowerOrEqualTo checks if the version represented by the string is lower than or equal to the provided SemanticVersion.
func SimplifyImportPaths ¶
SimplifyImportPaths simplifies the paths in import statements as file will already be present in the directory for future consumption and is rather corrupted for import paths to stay the same.
func StripExtraSPDXLines ¶
StripExtraSPDXLines removes the extra SPDX lines from the content. This is used when passing combined source to the solc compiler as it will complain about the extra SPDX lines.
func StripImportPaths ¶
StripImportPaths removes the import paths entirely from the content.
func ToJSONPretty ¶
ToJSONPretty returns a pretty-printed JSON representation of the provided interface. This function is primarily used for debugging purposes.
func ToProtoJSON ¶
ToProtoJSON converts a Go struct to its JSON representation.
func WriteToFile ¶
WriteToFile writes the provided data byte array to a file at the provided path.
Types ¶
type NormalizationInfo ¶ added in v0.3.1
NormalizationInfo represents the result of a type normalization. It includes the normalized type name and a flag indicating whether the type name was actually normalized.
type NormalizeType ¶ added in v0.3.1
type NormalizeType struct{}
NormalizeType provides methods for normalizing type names.
func NewNormalizeType ¶ added in v0.3.1
func NewNormalizeType() *NormalizeType
NewNormalizeType creates and returns a new NormalizeType instance.
func (*NormalizeType) Normalize ¶ added in v0.3.1
func (n *NormalizeType) Normalize(typeName string) NormalizationInfo
Normalize attempts to normalize the given type name. It returns the NormalizationInfo which contains the normalized type name and a flag indicating if the provided type name was actually normalized.
type SemanticVersion ¶ added in v0.3.1
type SemanticVersion struct {
Major int `json:"major"`
Minor int `json:"minor"`
Patch int `json:"patch"`
}
SemanticVersion represents a version in the format Major.Minor.Patch.
func ParseSemanticVersion ¶ added in v0.3.1
func ParseSemanticVersion(version string) SemanticVersion
ParseSemanticVersion converts a string representation of a version into a SemanticVersion struct. It expects the version string to be in the format "Major.Minor.Patch".