Documentation ¶
Index ¶
- Variables
- func ADD_LEADING_ZERO(myNum int) string
- func AM_I_ROOT() bool
- func CLIPBOARD_COPY(instring string)
- func COPY_FILE(source_file string, dest_file_name string)
- func CURR_DIR() string
- func Check_for_TZ_shortcut_or_IANA(TZ_to_use string) (bool, *time.Location)
- func DELETE_ITEM[T any](slice []T, s int) []T
- func DELETE_from_LIST[T any](slice []T, s int) []T
- func DETERMINE_Current_OS_and_PLATFORM()
- func DOES_FILE_CONTAIN(filename string, lookfor string) bool
- func DOES_FILE_EXIST(FULL_path_2_file string, ALL_PARAMS ...string) bool
- func DOEXIT(EXTRA_ARGS ...string)
- func DO_EXIT(EXTRA_ARGS ...string)
- func DownloadFile(filepath string, url string) error
- func FILE_EXISTS(path string) bool
- func FLOAT_to_STRING(input float64, ALL_PARAMS ...int) string
- func FLOAT_to_STRING32(input float32, ALL_PARAMS ...int) string
- func GEN_UNIQUE_ID(PARAMS ...interface{}) string
- func GET_BINARY_BUILT_FOR() (string, string)
- func GET_CURRENT_TIME(ALL_PARAMS ...string) (string, time.Time)
- func GET_EXTRA_ARG(key interface{}, EXTRA_ARGS ...interface{}) interface{}
- func GET_FILE_MD5(filePath string) (string, error)
- func GET_FILE_SIZE(bytes int64) (float64, float64)
- func GET_INPUT() string
- func GET_LAST_CHARs(s string, c int) string
- func GET_MD5(input string) string
- func GET_MONTH_NUM(month_name string) (string, int)
- func GET_PROPER_TZONE_Logic(requested_TZ string) *time.Location
- func GET_PUBLIC_IP() string
- func GET_USER_INPUT(ALL_PARAMS ...interface{}) string
- func GenSerial(serial_length int) string
- func Gen_RAND_Float(min float64, max float64) float64
- func Gen_RAND_INT(min int, max int) int
- func HAVE_DIR(input string) bool
- func HAVE_LINK(input string) bool
- func HasOnlyNumbers(s string) bool
- func INT64_to_STRING(input int64) string
- func INT_to_STRING(input int) string
- func IS_BOOL(param interface{}) bool
- func IS_DIR(input string) bool
- func IS_FILE_LINK(filename string) bool
- func IS_FLOAT(param interface{}) bool
- func IS_INT(param interface{}) bool
- func IS_LINK(input string) bool
- func IS_ODD_Num(inum int) bool
- func IS_STRING(param interface{}) bool
- func JUST_ALPHA_STRING(input string) string
- func LINK_ORIGIN(filename string) string
- func LOAD_Struct_from_FILE(FULL_path_2_file string, v interface{}, bequiet bool) error
- func MAKE_Sure_Running_As_ROOT()
- func MARK_END_TIME(start_TIME time.Time)
- func MARK_START_TIME() time.Time
- func MASTER_INIT(PROGNAME string, VERSION string, ALL_PARAMS ...string)
- func MOST_RECENT_DATE(first time.Time, second time.Time) bool
- func MT_Engine(desc string, MASTER_LIST []MT_THREAD_OBJ, child CHILD_IMPL_FUNC, ...)
- func NEW_UUID() string
- func NO_EXTRA_Spaces(input string) string
- func OPEN_FILE(path_to_file string) *os.File
- func OUTPUT_Format_Pretty_Logic(output_FORMAT string, input_DATE time.Time) string
- func PAD_STRING(input string, TOTAL_FINAL_LEN int, ALL_PARAMS ...string) string
- func PLACEHOLDER()
- func PLACE_HOLDER()
- func PRETTY_DATE(ALL_PARAMS ...interface{}) string
- func PRETTY_STRUCT_json(input interface{}) string
- func PRETTY_TIME(ALL_PARAMS ...interface{}) string
- func PROMPT(warning_TEXT string, required_input string)
- func Pager(tmax int)
- func PressAny(ALL_PARAMS ...interface{})
- func REMOVE_from_LIST[T any](slice []T, s int) []T
- func RUN_COMMAND(command_text string, ALL_PARAMS ...string) (string, []string)
- func SAVE_Struct_2_DISK(dest_file string, v interface{}) error
- func SHOW_BOX(ALL_PARAMS ...string)
- func SHOW_PERCENT(ALL_PARAMS ...interface{}) string
- func SHOW_PRETTY_DATE(ALL_PARAMS ...interface{}) string
- func SHOW_PROG_VERSION(vernum string)
- func SHOW_STRUCT(ALL_PARAMS ...interface{})
- func SHUFFLE_STRING(input_STRING string) string
- func START_Spinner()
- func STOP_Spinner()
- func STRING_to_FLOAT(input string) float64
- func STRING_to_FLOAT32(input string) float32
- func STRING_to_INT(input string) int
- func STRING_to_INT64(input string) int64
- func ShowNum(innum int) string
- func ShowNum64(innum int64) string
- func ShowNum_FLOAT(innum float64) string
- func Show_Total_RUNTIME()
- func Sleep(seconds int, ALL_PARAMS ...bool)
- func TOUCH_FILE(filename string)
- func UNICODE_REMOVE_ALL_SPACES(str string) string
- func UpperFirst(inString string) string
- func VERIFICATION_PROMPT(warning_TEXT string, required_input string, ALL_PARAMS ...interface{}) bool
- func WRITE_FILE(FULL_FILENAME string, TEXT_for_FILE string, ALL_PARAMS ...string) bool
- type CHILD_IMPL_FUNC
- type FILE_INFO_OBJ
- type IP
- type MT_THREAD_OBJ
Constants ¶
This section is empty.
Variables ¶
var BOX_INDENT_SPACES = " "
This is a nice way of showing a message in a box Just pass each line you want in the box as a seperate parameter
╭――――――――――――――――――╮ │ │ │ │ │ │ ╰――――――――――――――――――╯
var CHECK_VERSION = false
var CST_Location_OBJ, _ = time.LoadLocation("America/Chicago") // aka CST }
var CURRENT_ARCH = ""
var CURRENT_OS = ""
var DEBUG_MODE = false
var EST_Location_OBJ, _ = time.LoadLocation("America/New_York")
var GLOBAL_CURR_DATE = "" // Current Actual Date in the Timezone we specified
var GLOBAL_PREFIX = " ==| "
- - - - - - - - - - - - START OF GLOBALS WE NEED - - - - - - - - - - - - - -
var LOCAL_Location_OBJ, _ = time.LoadLocation("Local")
var MST_Location_OBJ, _ = time.LoadLocation("America/Denver") // MDT / Mountain Standard
var Marshal = func(v interface{}) (io.Reader, error) { b, err := json.MarshalIndent(v, "", "\t") if err != nil { return nil, err } return bytes.NewReader(b), nil }
var NULL_FLOAT = -69.69696969
var NULL_INT = -69696969
Generic null ints and floats to use .. when using just 0 isnt sufficient
var ON_ARM = false
var ON_LINUX = false
We need to determine what the CURRENT running platform is
var ON_MAC = false
var ON_WINDOWS = false
var PAGE_COUNT = 0
var PAGE_MAX = 5
var PROG_START_TIME string
var PROG_START_TIMEOBJ time.Time
var PST_Location_OBJ, _ = time.LoadLocation("America/Los_Angeles") // aka PST
Reverse w UNDERLINE.. Only setting up the ones that work best on Black background terminals
This shows with UNDERLINE
var SPINNER_CHAR = 4
var SPINNER_SPEED = 100
var USING_ARM = false
var UTC_Location_OBJ, _ = time.LoadLocation("UTC")
var Unmarshal = func(r io.Reader, v interface{}) error { return json.NewDecoder(r).Decode(v) }
Unmarshal is a function that unmarshals the data from the reader into the specified value. By default, it uses the JSON unmarshaller.
Functions ¶
func ADD_LEADING_ZERO ¶
ADD_LEADING_ZERO: This takes in a number and returns a string with a leading 0 If the number is already 10 or greater, it returns that same number as is SHOW_PRETTY_DATE is dependant on this
func CLIPBOARD_COPY ¶
func CLIPBOARD_COPY(instring string)
When called, copies a specified string to the users CLIPBOARD
func DELETE_ITEM ¶
func DELETE_from_LIST ¶
func DETERMINE_Current_OS_and_PLATFORM ¶
func DETERMINE_Current_OS_and_PLATFORM()
func DOES_FILE_CONTAIN ¶
func DOES_FILE_EXIST ¶
func DO_EXIT ¶
func DO_EXIT(EXTRA_ARGS ...string)
Easy way to quick exit a program without having to remember to import os
func DownloadFile ¶
DownloadFile will download a url to a local file. It's efficient because it will write as it downloads and not load the whole file into memory.
Courtesy of: https://golangcode.com/download-a-file-from-a-url/
func FILE_EXISTS ¶
This checks to see if a file or directory exists
func FLOAT_to_STRING ¶
Converts a float to a string.. If another number is specified, it is interpreted as decimal precision
func FLOAT_to_STRING32 ¶
func GEN_UNIQUE_ID ¶
func GEN_UNIQUE_ID(PARAMS ...interface{}) string
Generates a UNIQUE ID based on passed critieria. Mostly for Mongo ID vals Also accepts: -prefix - for an value to go before the id -raw - if you do DO NOT want to get an md5 generated value -delim - if you want to use somethiing OTHER than | for the delimiter
func GET_BINARY_BUILT_FOR ¶
This gets the platform we are running on (mac, linux, windows)
func GET_EXTRA_ARG ¶
func GET_EXTRA_ARG(key interface{}, EXTRA_ARGS ...interface{}) interface{}
FOr Dynamic Parameter support... DONT FORGET THE ... thre dots!!! Examples:
for function call: WRITE_EMBED("ca.pem.gz", "verbose", "quiet", 55, "www.podshop.com")
Then write the function like this: func WRITE_EMBED(name string, EXTRA_ARGS ...interface{}) string { var verbose = GET_EXTRA_ARG("verbose", EXTRA_ARGS...).(bool) // specify verbose will set to TRUE... case verbase was passed as a parameter var bequiet = GET_EXTRA_ARG(1, EXTRA_ARGS...).(string) // parameter at index 1 is quiet.. So bequiet is set to string "quiet"
var antcount = GET_EXTRA_ARG(2, EXTRA_ARGS...).(int) // parameter at index 2 is the number 55... so antcount is set to specify 2 to get the INT value 55 that was specified var mydomain = GET_EXTRA_ARG(3, EXTRA_ARGS...).(string) // and.. specify 3 to get the param at index 3 (which is www.podshop.com) C.Println(" RESULT Verbose is: ", verbose) C.Println(" antcount is: ", antcount) C.Println(" mydomain is: ", mydomain) }
func GET_FILE_MD5 ¶
Easy way to get teh MD5 of a file
func GET_FILE_SIZE ¶
Returns file size in MEGS and BYTES
func GET_LAST_CHARs ¶
func GET_MONTH_NUM ¶
Gets a numeric month from a text indicator
func GET_PROPER_TZONE_Logic ¶
func GET_USER_INPUT ¶
func GET_USER_INPUT(ALL_PARAMS ...interface{}) string
func GenSerial ¶
This generates a serial.. usually used discern between multiple execution runs like in jenkins
func Gen_RAND_Float ¶
Generates random range of FLOATS from MIN to MAX
func Gen_RAND_INT ¶
Generates random range of INTS from MIN to MAX
func HasOnlyNumbers ¶
Returns true if the string contains ONLY numbers
func INT64_to_STRING ¶
func INT_to_STRING ¶
func IS_FILE_LINK ¶
Determines if a file is a sym link or not
func IS_INT ¶
func IS_INT(param interface{}) bool
= = = = = = = = = = = = Better versions of the IS_xxx functions = = = = = =
func IS_ODD_Num ¶
func JUST_ALPHA_STRING ¶
This takes in a string and removes all non alphanumeric chars from it.. and extra spaces
func LOAD_Struct_from_FILE ¶
Load loads the file at path into v. Use os.IsNotExist() to see if the returned error is due to the file being missing.
func MAKE_Sure_Running_As_ROOT ¶
func MAKE_Sure_Running_As_ROOT()
This makes sure we're running as run.. program exists otherwise
func MARK_END_TIME ¶
Takes start_TIME and gets the total time elapsed and displays a status
func MARK_START_TIME ¶
func MASTER_INIT ¶
func MOST_RECENT_DATE ¶
If first is more recent than second, we return true
func MT_Engine ¶
func MT_Engine(desc string, MASTER_LIST []MT_THREAD_OBJ, child CHILD_IMPL_FUNC, PARAMS ...interface{})
Multi Thread Engine! Takes in a function implemented like CHILD_IMP_FUNC .. as a parameter EXAMPLE:
var chimp = func(item MT_THREAD_OBJ, WAIT_GROUP *sync.WaitGroup) { // if using a a struct, expand data like this // If DATA is just a native string , int.. use // pobj := item.DATA.(string) pobj := item.DATA.(PRICE_TA_OBJ) prefix := item.THREAD_PREFIX C.Println(prefix, " ") Y.Print(" PTA_hey Symbole is: ") W.Print(" EXTRA FLAG: ", item.EXTRA_FLAG) G.Println(pobj.SYMBOL) WAIT_GROUP.Done() //call this.. tells the MT Engine this thread is DONE } // pass a number for total number of threads to use.. pass true/false to "sleep" between go routine invocations
func NO_EXTRA_Spaces ¶
This removes all extra spaces in a string
func OUTPUT_Format_Pretty_Logic ¶
Handles the logic for the OUTPUT_Format requested
func PAD_STRING ¶
This padds a string that is passed and makes it a total LENGH of TOTAL_FINAL_LEN Pass a character as a string param and it will pad with THAT char instead of space
func PLACEHOLDER ¶
func PLACEHOLDER()
func PLACE_HOLDER ¶
func PLACE_HOLDER()
a simple placeholder.. if you arent using anything in GOGO Gadgets main (at the moment) this will prevent you getting a "imported but not used" error
func PRETTY_DATE ¶
func PRETTY_DATE(ALL_PARAMS ...interface{}) string
func SHOW_PRETTY_DATE(ALL_PARAMS ...interface{}) string { alias for SHOW_PRETTY_DATE
func PRETTY_STRUCT_json ¶
func PRETTY_STRUCT_json(input interface{}) string
func PRETTY_TIME ¶
func PRETTY_TIME(ALL_PARAMS ...interface{}) string
func Pager ¶
func Pager(tmax int)
This is a basic Paging routine that prompts you to PressAny key after x number of items have been shown
func REMOVE_from_LIST ¶
func RUN_COMMAND ¶
NOTE here is teh way to use cmd.Exec WITH environment variables: cmd := exec.Command("go", "build", "-ldflags=-s -w -X main.VERSION_NUM=" + VERSION_to_USE, "-buildmode=exe", "-o", FULL_DEST_FILE ) cmd.Env = os.Environ() cmd.Env = append(cmd.Env, "GOOS=" + BIN_TYPE) cmd.Env = append(cmd.Env, "GOARCH=" + ARCH) output, err := cmd.CombinedOutput() if err != nil { R.Println(" Error in RUN COMMAND: ", err) } C.Println(string(output))
Much better ver of RUN_COMMAND Specify -verbose -rundir or -showoutput, -hideerror
func SAVE_Struct_2_DISK ¶
EXTRA_ARGS ...interface{}) {
var have_alt, alt_val = GET_EXTRA_ARG(0, EXTRA_ARGS...) var verbose, _ = GET_EXTRA_ARG("verbose", EXTRA_ARGS...)
func SHOW_PERCENT ¶
func SHOW_PERCENT(ALL_PARAMS ...interface{}) string
This takes in a number (float) and shows it as pretty PERCENT string // Specify another INT to define PRECISION
func SHOW_PRETTY_DATE ¶
func SHOW_PRETTY_DATE(ALL_PARAMS ...interface{}) string
func SHOW_PRETTY_DATE(input_DATE time.Time, EXTRA_ARGS...string) string {
func SHOW_PROG_VERSION ¶
func SHOW_PROG_VERSION(vernum string)
func SHOW_STRUCT ¶
func SHOW_STRUCT(ALL_PARAMS ...interface{})
Super Useful to show structures... ANY Structure .. in JSON Format
func SHUFFLE_STRING ¶
This takes IN a string and returns a shuffle of the characters contained in it
func START_Spinner ¶
func START_Spinner()
Creates a cool "im busy right now" status spinner so you know the program is running
func STOP_Spinner ¶
func STOP_Spinner()
func STRING_to_FLOAT ¶
func STRING_to_FLOAT32 ¶
func STRING_to_INT ¶
func STRING_to_INT64 ¶
func ShowNum ¶
This utilizes the HUMANIZE library and shows a HUMAN readable number of the passed variable
func ShowNum_FLOAT ¶
Shows a pretty Number based on passed FLOAT
func Show_Total_RUNTIME ¶
func Show_Total_RUNTIME()
Shows the amount of time a program ran (and start and end time)
func TOUCH_FILE ¶
func TOUCH_FILE(filename string)
func UNICODE_REMOVE_ALL_SPACES ¶
This removes all spaces from a string via unicode
func UpperFirst ¶
Make sthe first character of a string UPPER CASE
func VERIFICATION_PROMPT ¶
Types ¶
type CHILD_IMPL_FUNC ¶
type CHILD_IMPL_FUNC func(MT_THREAD_OBJ, *sync.WaitGroup)
type FILE_INFO_OBJ ¶
type FILE_INFO_OBJ struct { NAME string TYPE string IS_DIR bool IS_LINK bool LINK_ORIGIN string PATH string FULL_PATH string SIZE float64 DATE string TIME string }
func GET_FILE_INFO ¶
func GET_FILE_INFO(filename string) FILE_INFO_OBJ
type MT_THREAD_OBJ ¶
Source Files ¶
- GOGO.go
- GOGO_ColorText.go
- GOGO_FileOPS.go
- GOGO_FileOPS_GET_FILE_INFO.go
- GOGO_GEN_RANDOM.go
- GOGO_GEN_Unique_ID.go
- GOGO_Get_Extra_Arg_BETA.go
- GOGO_Get_MONTH_and_DOW.go
- GOGO_MISC.go
- GOGO_MT_MultiThreading_ENGINEy.go
- GOGO_RUN_COMMAND.go
- GOGO_SHOW_BOX.go
- GOGO_SHOW_PrettyDate.go
- GOGO_ShowNum_Is_INT_MISC.go
- GOGO_StringOPS.go