Go cmd utility that prints its command line arguments using strings.Join

Results

This is an exercise of the book The Go Programming Language, by Alan A. A. Donovan and Brian Kernighan.

Comparison between different versions of the echo program.

Version 1

This approach is simply iterating over the arguments provided, starting at index 1.

The execution time in average is 0.099s.

Version 2

This approach also iterates over the arguments, just that it iterates over a slice that starts at index 1.

The execution time in average is 0.182s.

Version 3

This approach uses strings.Join to join its command-line arguments and then prints them to the standard output.

The execution time in average is 0.180s.

Conclusion

They are not so different, and using range was actually slower.

Owner
Santiago Rodriguez
Software Engineer - Golang, JavaScript, Ruby, Linux Servers, HTML, CSS
Santiago Rodriguez
Similar Resources

A command line tool that builds and (re)starts your web application everytime you save a Go or template fileA command line tool that builds and (re)starts your web application everytime you save a Go or template file

# Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web framework yo

Nov 22, 2021

A command line tool to prompt for a value to be included in another command line.

readval is a command line tool which is designed for one specific purpose—to prompt for a value to be included in another command line. readval prints

Dec 22, 2021

`tmax` is a powerful tool to help you get terminal cmd directly.

`tmax`  is a powerful tool to help you get terminal cmd directly.

The positioning of tmax is a command line tool with a little artificial intelligence. If you frequently deal with the terminal daily, tmax will greatly improve your work efficiency.

Oct 15, 2022

Blocking CMD shell interaction tool.

CliToolkit Blocking command line shell interaction tool. CliToolkit is a small cmd package for Go cmd shell interaction application. Installation # do

Oct 28, 2021

Todo-cmd: an app you can add your tasks , edit or delete them

TODO CMD APP! 🧙‍♂️ Table of contents General info Update Requirements set-up usage General info todo-cmd is an app you can add your tasks , edit or d

Dec 13, 2021

Gostall - Run go install ./cmd/server and not have the binary install in your GOBIN be called server?

GOSTALL Ever wanted to run go install ./cmd/server and not have the binary insta

Jan 7, 2022

all-in-one cmd tool to search man page of different platform

Overview remote-man is an all-in-one cmd tool to search man page of different platform. support search platform Linux MacOS FreeBSD Installation compi

Oct 31, 2022

A simple go program which checks if your websites are running and runs forever (stop it with ctrl+c). It takes two optional arguments, comma separated string with urls and an interval.

uptime A simple go program which checks if your websites are running and runs forever (stop it with ctrl+c). It takes two optional arguments: -interva

Dec 15, 2022

📷 Command-line utility to download all photos from Instagram

📷 Command-line utility to download all photos from Instagram

Instagram Downloader This is a simple command-line tool, written in Go, to download all images from an Instagram account. Getting Started Install inst

Sep 9, 2022
argv - Go library to split command line string as arguments array using the bash syntax.

Argv Argv is a library for Go to split command line string into arguments array. Documentation Documentation can be found at Godoc Example func TestAr

Nov 19, 2022
A simple library to build golang command line (cli / cmd)apps

A simple library to build golang command line (cli / cmd)apps

Jan 11, 2022
A tool to enumerate all the command-line arguments used to start a Linux process written in Go.
A tool to enumerate all the command-line arguments used to start a Linux process written in Go.

ranwith A tool to enumerate all the command-line arguments used to start a Linux process written in Go. ranwith uses the Linux /proc directory to obta

Jun 30, 2022
Package osargs provides functions to parse command line arguments

osargs About Package osargs provides functions to parse command line arguments. It is published on https://github.com/vbsw/osargs and https://gitlab.c

May 8, 2022
It‘s a cmd-line tool like `make` and `task`, supporting nested args and alias using `cobra`

It‘s a cmd-line tool like `make` and `task`, supporting nested args and alias using `cobra`. It's a makefile alternative and a shell wrapper.

Oct 18, 2022
This is a command that simply prints "ok" onto your screen whenever you run the "ok" command
This is a command that simply prints

ok This is a command that simply prints "ok" onto your screen whenever you run the ok command Installation (Linux) Download the latest release and sud

Sep 16, 2022
linenoise-classic is a command-line tool that generates strings of random characters that can be used as reasonably secure passwords.

linenoise-classic is a command-line tool that generates strings of random characters that can be used as reasonably secure passwords.

Aug 21, 2022
kcli: command line interface tool to interact with K8trics API server as well as manage its lifecycle
kcli: command line interface tool to interact with K8trics API server as well as manage its lifecycle

K8trics CLI (kcli) kcli is command line interface tool to interact with K8trics API server as well as manage its lifecycle. kcli can provision and dep

Dec 15, 2021
A command-line interface for the Riak database through its HTTP API
A command-line interface for the Riak database through its HTTP API

Riakg Description Is a development oriented command line tool that enables navigation on buckets, keys and values of a Riak KV data store using it's H

Dec 31, 2022
An open-source GitLab command line tool bringing GitLab's cool features to your command line
An open-source GitLab command line tool bringing GitLab's cool features to your command line

GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to where you are already working with git and your code without switching

Dec 30, 2022