{"repo":"go-monk/from-bash-to-go","free":true,"listed":false,"github":"https://github.com/go-monk/from-bash-to-go","clone":"git clone https://github.com/go-monk/from-bash-to-go.git","description":"Bash is great until it isn't","language":"Go","stars":52,"topics":["devops","bash"],"license":null,"category":"deployment-docker-iac","readme_excerpt":"If you're in DevOps, SRE, or cybersecurity, you’ve probably written countless Bash scripts to automate or glue things together. Bash is a good tool for these tasks, provided the programs are small and simple. However, as they grow more complex, they become harder to understand and modify. Additionally, the dependency on external tools (like curl , awk , jq ) makes them difficult to deploy across diverse systems. Well-written programs in Go alleviate these Bash shortcomings significantly and bring new advantages, including a cultural agenda of radical simplicity that brings more joy :-). Follows a quick tutorial to give you a taste of migrating from Bash to Go. For a deeper dive, see this series: - https://github.com/go-monk/from-bash-to-go-part-i - https://github.com/go-monk/from-bash-to-go-part-ii - https://github.com/go-monk/from-bash-to-go-part-iii 0) Quick Health Check Script Consider this simple health check script: Here's the Go equivalent: To test the programs above, you can run a dummy web server from the healthz folder: The server exposes three endpoints: - http://localhost:8080/healthz - returns 200 (OK) - http://localhost:8080/healthz2 - returns 301 (moved permanently) - http://localhost:8080/healthz3 - returns 200 after three seconds Now you can run the scripts: Remember the Unix philosophy: no news is good news :-). You can check the exit status of each of the above commands with echo $? - 0 means all good. At first glance, there isn't much difference except for ","default_branch":null,"files":null,"tree":[],"storefront":"/r/go-monk","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/go-monk/from-bash-to-go/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}