Tag Archives: Golang

Display File, Function, and Line Number in Go (Golang)

Years ago, I used a macro in C and C++ programs to provide information on the current line of code being executed. I used this in error handlers and exception traps in addition to other information. Displaying the file name … Continue reading

Posted in Programming | Tagged | Leave a comment

A TCP Echo Server in Go (Golang)

I had the need to test connectivity between a couple of servers, recently. Netcat wasn’t available so we managed to cobble something together that worked for the particular situation. An “echo server” is a program that people often code as … Continue reading

Posted in Programming | Tagged | Leave a comment

Pretty-Printing an S-Expression in Go

My friend Mike and I seem to implement Forth-like and Lisp-like mini-languages continuously.  While I used to implement small interpreters for these languages in C, I found that languages with built-in support for regular-expressions allowed me to quickly write lexical … Continue reading

Posted in Programming | Tagged | Leave a comment

Yet Another Config File Reader for Go (Golang)

I’ve been working up to some larger projects as I learn Go.  One of my current projects now needs the ability to parse a configuration file. I’ve looked at a few of the existing options.  There are parsers for Windows-style … Continue reading

Posted in Programming | Tagged | Leave a comment

Filling a Slice Using Command-line Flags in Go (Golang)

I wanted to be able to specify a particular command-line flag more than once in a Go program. I was about to throw my hands up in despair because I didn’t think that the Go flag package could process multiple … Continue reading

Posted in Programming | Tagged | 2 Comments

An RPN Interpreter in Go (Golang)

I built a non-Turing-complete interpreter in Go whose current incarnation is simply named “rpnrepl”.  rpnrepl is a very tiny stack-based, postfix language whose syntax is similar to that of the Forth programming language. rpnrepl can only perform four mathematical operations, … Continue reading

Posted in Programming | Tagged , | 2 Comments

Simulating Try-Catch in Go ( Golang )

In the Go code I’ve been writing to help learn the language, I’ve been using a common function to deal with error conditions.  The function terminateOnErr(err error) checks to see if the err parameter is nil.  If not, it displays … Continue reading

Posted in Programming | Tagged | 1 Comment

Sending GMail with Go (Golang)

I needed a command-line e-mail sender utility that would send e-mail via my GMail account. I wanted the solution to work on Windows and OS/X for the time being. My solution is a utility named GSend. GitHub repo: https://github.com/jimlawless/gsend/ The Go … Continue reading

Posted in Programming | Tagged , , | Leave a comment

Variant Types in Golang

Here we Go again… I had corresponded with some seasoned Go programmers about variant types some time ago.  I was searching for a way to keep a slice of data where each element might be a different data-type.  The approach … Continue reading

Posted in Programming | Tagged | 9 Comments