utils

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 6 Imported by: 65

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpNodeNoExit

func DumpNodeNoExit(whatever interface{})

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 interface{})

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 SimplifyImportPaths

func SimplifyImportPaths(content string) string

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

func StripExtraSPDXLines(content string) string

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

func StripImportPaths(content string) string

StripImportPaths removes the import paths entirely from the content.

func ToJSON

func ToJSON(data interface{}) ([]byte, error)

ToJSON converts a Go struct to its JSON representation.

func ToJSONPretty

func ToJSONPretty(data interface{}) ([]byte, error)

ToJSONPretty returns a pretty-printed JSON representation of the provided interface. This function is primarily used for debugging purposes.

func ToProtoJSON

func ToProtoJSON(data interface{}) ([]byte, error)

ToProtoJSON converts a Go struct to its JSON representation.

func WriteToFile

func WriteToFile(path string, data []byte) error

WriteToFile writes the provided data byte array to a file at the provided path.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL