appsec.fyi

A somewhat curated list of links to various topics in application security.

Golang

LinkExcerpt
Golang Internals ResourcesThis is a curated collection of Articles and Videos about Golang internals. It is intended for advanced/intermediate programmers who are new to Golang and want to understand what happens under the hood. Feel free to add to it! How does the golang scheduler work? by Ian Lance Taylor
Top Golang FrameworkGo was created by Google about ten years ago when they were experiencing extremely long wait times for C++ to compile. Since this created a bottleneck, they decided to find a solution which was an entirely new programming language.
1 min guide to Golang development best practices in 20221. Use Go Modules — It is go’s a dependency management system, that makes dependency version information simple, explicit, and easy to manage. From this article, you can start using go modules in your application. 2. Use Gin — Gin is widely used for building web APIs and microservices.
Progress Bar With GoFollowing tutorial is intended for anyone who are curious about the beauty of the APT progress bar; also includes the people who still use the command line.
bluesentinelsec/OffensiveGoLangOffensive GoLang is is a collection of Go packages containing commonly used cyber adversary emulation functions. Offensive GoLang accomplishes nothing by itself; rather, it is intended to support rapid red team tool development by providing common functions in a modular format.
Secure Coding with GoGoogle Go (also known as Golang) continues its role as a popular software language that enables developers to ship quality code at a rapid pace.
Go security cheatsheet: 8 security best practices for Go developersIn this installment of our cheatsheet series, we’re going to cover eight Go security best practices for Go developers.
Decorator Pattern in GoThis is the third chapter of the “Head First Design Patterns” book. I have covered the Strategy and Observer patterns before. We are told to design an ordering application at a coffee shop. It sells a variety of beverages like
WebSocket communication between two Go programs, the easy wayThis article was written with one idea in mind: to show you, how to make a communication between two Go programs, using WebSockets. The simplest possible way.
The Only Introduction to Golang You NeedGo, or also called Golang, is absolutely trendy, and rightly so. It is not as difficult to learn as C or C++, but still quite fast, and has a great community & many interesting and helpful packages and libraries.
Go WasmGo Wasm is a Go development environment with the essentials to write and run code entirely within the browser, using the power of WebAssembly (Wasm). Want to discuss an idea or a bug? Open up a new issue and we can talk about it. Pull requests are welcome.
How to Write Bug-Free Goroutines in Go (Golang)Go is well-known and loved for its concurrency. The go runtime manages lightweight threads called goroutines. Goroutines are quick and simple to write. You just type go before the function you want to execute asynchronously, in another thread.
Creating an Authentication API with Golang — Using Gin & NrokYou will need to have Go installed on your machine, which you can download for free over here. To get started, we create a new project. Create a new file called main.go and enter the following starter code:
Your Master Plan to Learn Golang Fast and Deep (2021 Edition)If you must (or like to) learn Go (Golang), this article will point you in the right direction. If you are still unsure, should you learn Go or another language, let me tell you a few facts and stats to help you make the right decision.
Closures Made Simple With GolangIn Golang, a closure is a function value that references variables outside its own function body. A closure can outlive the scope in which it was created and thus access variables within that scope, even though the scope is exited.
roxyOur mascot, Roxy Lalonde. See our GitHub Pages site for more documentation.
tdewolff/canvasCanvas is a common vector drawing target that can output SVG, PDF, EPS, raster images (PNG, JPG, GIF, ...), HTML Canvas through WASM, OpenGL, and Gio. It has a wide range of path manipulation functionality such as flattening, stroking and dashing implemented.
jakubDoka/mlokSkip to content Sign up Sign up Sign in Sign up Sign up {{ message }} Permalink main mlok/examples/basics/hasher/main.go /Jump to Go to file jakubDoka adding boid demo Latest commit 84de7b1 Mar 30, 2021 History 1 contributor You can’t perform that action at this time.
Retraction: My Go Executable Files Are Still Large (What's New in 2021)In 2019, we published an exploration of the size and makeup of the executable files produced by the Go compiler. CockroachDB engineers, the Go team, and the greater Go community were intrigued by the analysis, and the results of it pushed our projects further.
The Backend Development Engine built for GoEncore makes it super easy to create backend services and APIs. Built ground up for Go, Encore uses static analysis and code generation to provide a revolutionary developer experience that is extremely productive. No Boilerplate: Set up a production ready backend application in minutes.
What's the "sync.Cond" | dtyler.ioGo’s sync.Cond is a synchronization primitive for multithreaded (goroutine, to be precise) programming. Compared to mutexes, sync.Cond has limited use cases, and its usage seems to be rather complicated. Also, I don’t see enough explanations or examples of it.
How to set up Vim for Go DevelopmentOne of the major reasons I love programming in Go is that I can do it in any IDE or editor I want, including my favourite Vim editor.
gopsgops gops is a command to list and diagnose Go processes currently running on your system.$ gops 983 980 uplink-soecks go1.9 /usr/local/bin/uplink-soecks 52697 52695 gops go1.10 /Users/jbd/bin/gops 4132 4130 foops * go1.9 /Users/jbd/bin/foops 51130 51128 gocode go1.9.
progressbarA very simple thread-safe progress bar which should work on every OS without problems. I needed a progressbar for croc and everything I tried had problems, so I made another one. In order to be OS agnostic I do not plan to support multi-line outputs. The progressbar implements an io.
Google’s Golang — The Perfect Solution to Super-fast BuildingFrom the large variety of programming languages, you can always find the right one that will be the most helpful for solving some specific task you come upon with. In this article, you will learn about the basics of the Go programming language, which is primarily developed at Google.
Different ways to send an email with GolangIn this blog, we’ll look at different methods to send an email with Go, First, we will explore inbuilt smtp package, then we will move to use a popular package Gomail and finally, we will send HTML emails using custom templates. smtp is an inbuilt package provided with Golang.
Why Go has become my favourite language for almost anythingA couple of years ago at work I was tasked to build the software of an IoT thing. The program had to run on a development board with an ARM Linux distribution and I had complete control on how to structure the project.
Automate Your Go Applications With Gradle & DockerThere’s a consistent demand for speed and efficiency when developing software solutions. Not only do your applications need to compile flawlessly, but today’s modern tech space has forced the “it works on my machine” phrase to become a vulgarity.
20 Go Packages You Can Use in Your Next ProjectGo is an amazing language that you can use to build almost any kind of program. Developed in 2007, it has the ease of an interpreted language while also being fast and efficient as a compiled language. It was also built thinking about concurrency and getting advantage of the multicore machines.
Rust vs. Go: Why They’re Better TogetherSteve Francia Over the past 25 years Steve Francia has built some of the most innovative and successful technologies and companies which have become the foundation of cloud computing, embraced by enterprises and developers all over the world.
How To Become a Golang Developer: A 6-Step Career GuideGolang (also called Go) is an in-demand programming language — especially for people working with Google products. Go is used by many big companies, like Uber, Medium, Dropbox, Salesforce, Netflix, IBM, and Twitter. Go is a great option for job seekers of all levels.
Go for Java Devs — Pointers, Error Handling, and ConcurrencyIn this series’ first article, I described myself as a long-time Java engineer who has recently decided to give Go a go. Although I’ll always love Java, I know that it’s important to keep learning languages.
GopherCon 2020: Jaana Dogan - Debugging Code Generation in GoHave you ever tried to understand how the Go toolchain takes your source code and generates a binary? Have you ever wondered how you can inspect machine code generated from Go source code? Or, have you ever optimized some Go code to later realize Go compiler is already doing the same optimization au
(Pre-Launch) Build a Twitter clone GraphQL API using GolangHello everyone :) My name is Emanuel I’m from Québec Canada. I’ve started working on a videos course with Golang where I show you how to build a twitter clone in graphql.
Just released go-reddit v1.0.0, a Go library for accessing the Reddit APIWorks well, thank you! Glad to hear! Thank you for trying it out.
Rust vs. Go: Why They’re Better TogetherSteve Francia Over the past 25 years Steve Francia has built some of the most innovative and successful technologies and companies which have become the foundation of cloud computing, embraced by enterprises and developers all over the world.
How To Crack the Top 25 Golang Interview QuestionsThe Go programming language, or Golang, is an open source programming language similar to C but optimized for quick compiling, seamless concurrency, and developer ease of use.
The Decorator Pattern In GoThe final product is oddly satisfying. The Decorator pattern is an incredibly useful and flexible technique to create forward-thinking code. It allows you to add functionality to an object dynamically at run time instead of compile time.
3 Concurrent Patterns Used in GolangWhen a program or an algorithm is concurrent, it means that it is designed to be decomposed into smaller parts that will be executed in independent processes in parallel. In other words, as Rob Pike said: Concurrency has a lot to do with the design of your program.
How To Build a Basic Blockchain in GoBlockchain technologies have been referenced by some as the most influential invention since the internet itself. While the public interprets blockchain synonymously with speculative cryptocurrencies, blockchain actually has an incredibly broad range of applications for the modern world.
Go for Java Devs — The BasicsAs someone who’s programmed in Java for almost as long as the language has existed, I’ll always consider myself a “Java guy”.
Coding Problem: Sorted Squared Array in GoLearn two solutions and write table-driven tests! I believe it’s a good practice for software engineers to practice coding interview problems on a routine basis.
Automate Your Go Applications With Gradle & DockerThere’s a consistent demand for speed and efficiency when developing software solutions. Not only do your applications need to compile flawlessly, but today’s modern tech space has forced the “it works on my machine” phrase to become a vulgarity.
Practical Go Lessons
Build a Web Crawler in GoOne of the basic tests I use to try out a new programming language is building a web crawler.
Creating a web crawler in Go with CollyWeb scraping is a technique that lets you inspect, parse, and extract data from websites that would have otherwise been difficult to access due to the lack of a dedicated API.
Develop a Large-scale Concurrent URLs Scraper in GoThis semester I participated in a course on network data mining, which includes a crawler-related project that had much room for technical play, and I think it is worth writing an article to share.
💻 PTerm | Pretty Terminal PrinterTo make PTerm available in your project, you can run the following command. Make sure to run this command inside your project, when you're using go modules 😉
Coding Problem: First Non-Repeating Character in GoThis article is part of my personal habit of writing coding problems in with my most relevant language to stay sharp on my programming and problem solving skills. The First Non-Repeating Character question is a well-known beginner computer science question.
How I create small Go apps quicklyI often want to create a small web application to test out an idea or demonstrate some thing, and I’ve developed a small toolbox that helps me do so in Go.
Building a BitTorrent client from the ground up in GoThis post is also available in Russian, Korean, and Chinese. BitTorrent is a protocol for downloading and distributing files across the Internet.
Go: Using a Closure in Place of a StructThis note isn’t suggesting a pattern to follow, it’s a thought exercise. Let’s look at using a closure where we’d idiomatically use a struct. For this thought exercise, we will implement a Fibonacci Number sequence generator two ways, once with a struct and once with a closure.
go-internalsClick here for the GitBook version. All kinds of contributions are very much welcome.
50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang DevsGo is a simple and fun language, but, like any other language, it has a few gotchas... Many of those gotchas are not entirely Go's fault. Some of these mistakes are natural traps if you are coming from another language. Others are due to faulty assumptions and missing details.
Bitcoin HD Wallet with Golang and gRPC (Part l)In this tutorial series, we are going to learn how to create an HD bitcoin wallet using Golang. The idea of the tutorial series is not only showing how to create the Wallet and getting balances but also how to implement a grpc server and a CLI tool and a web-app for consuming it.
Go: The Idea Behind Sync.PoolI encountered a problem in Go Garbage Collection inside a project of mine recently. A massive amount of object were allocated repeatedly and caused a huge workload of GC. Using sync.Pool I was able to decrease the allocations and GC workload. One of the highlights of Go 1.3 release was sync Pool.
How I build web frontends in GoGo is a great language for building all kinds of backend services like APIs or microservices and many people use it for that. But what about web frontends, specifically dynamically rendered web applications? Let’s have a look…
Collaborative form editor using WebSockets | Web Sockets in Golang and ReactWant real-time communication across clients and asynchronously handle every incoming event across client modules and broadcast it to multiple registered services without long polling for the data? Want to create a chatting application? Websockets might just be your best friend for this particular us
"go get" command · golang-101-hacks"go get" command "go get" command is the standard way of downloading and installing packages and related dependencies, and let's check the particulars of it through an example: (1) Create a playstack repository in github; (2) There is a LICENSE file and play directory in playstack folder; (3) The pl
5 Common mistakes in GoBug-risks are issues in code that can cause errors and breakages in production. A bug is a flaw in the code that produces undesired or incorrect results.
generativeartgenerativeart is a Go package to generate many kinds of generative art. The goal is to collect some excellent generative art (implemented in R or Processing), and rewrite them in Go again.
Go: What Does a Goroutine Switch Actually Involve?Goroutines are light; they just need a memory stack of 2Kb to run. They are also cheap to run; switching a goroutine to another one does not require many operations. Before jumping into the switch itself, let’s review how the switch works at a higher level.
Finding Evil Go PackagesBecause of the big SolarWinds hack and the recent blog post describing a new Dependency Confusion attack, there has been a lot of talk lately about supply chain attacks, the sneaky technique of compromising less secure elements in a supply chain to compromise more secure targets.
Go Data Structures: InterfacesGo's interfaces—static, checked at compile time, dynamic when asked for—are, for me, the most exciting part of Go from a language design point of view. If I could export one feature of Go into other languages, it would be interfaces.
The Laws of ReflectionReflection in computing is the ability of a program to examine its own structure, particularly through types; it's a form of metaprogramming. It's also a great source of confusion. In this article we attempt to clarify things by explaining how reflection works in Go.
ConstantsGo is a statically typed language that does not permit operations that mix numeric types. You can't add a float64 to an int, or even an int32 to an int. Yet it is legal to write 1e6*time.Second or math.Exp(1) or even 1<<('\t'+2.0).
Strings, bytes, runes and characters in GoThe previous blog post explained how slices work in Go, using a number of examples to illustrate the mechanism behind their implementation. Building on that background, this post discusses strings in Go.
Go Slices: usage and internalsGo's slice type provides a convenient and efficient means of working with sequences of typed data. Slices are analogous to arrays in other languages, but have some unusual properties. This article will look at what slices are and how they are used.
How to learn internals of the Go Programming Language? For noobRecently I've participated several Go job interviews. The first one asked me How is channel implemented?, then the second one asked How is goroutine implemented?. Well as you can guess, the next one asked How is a Go interface implemented?.
Golang app in a container with hot reload and dynamic local packageA good way to develop Go applications is to use a Docker container to run them. In addition, having hot reloading is a useful feature to save time and directly see code updates.
go seof: Simple Encrypted os.FileEncrypted drop-in replacement of golang' os.File, the file stored will have 768 bits of encryption (Triple AES256 -yes- very silly and very secure). The resulting type can be used anywhere an os.File could be used. i.e.
What’s new in Go 1.16Go 1.16, the 17th major version of the Go programming language, has just been released. It is a significant upgrade that brings lots of long-awaited features and refinements to the language.
Virtual Filesystem in Go - Creating the foundationHi all. I posted earlier this week about a virtual filesystem project I wanted to start on in Go. So, I wrote my first real technical writing on the actual implementation and was interested in feedback on my technical writing and my Go so far.
Golang's Interfaces explained with MocksWhen I was learning Golang, one of the concepts that took me the most time to grasp was Interfaces. Golang's Interfaces are a great way to make modular and testable code. But they can also be a bit confusing at first glance.
Preventing SQL injections in Go (and other vulnerabilities)Go has taken the programming world by storm. When it recently passed its ten-year anniversary, estimates suggested as many as 2 million people use the language. As that number continues to grow, common mistakes have emerged that can lead to bugs and security vulnerabilities.
How Buffer Pool Works: An Implementation In GoI have been exploring how disk-oriented databases efficiently move data in and out of disk. One way, that I explored in Discovering and exploring mmap using Go and But how, exactly, databases use mmap?, is through memory-mapped files. Although mmap is a really neat solution, it has some troubles.
My Ultimate Makefile for Golang ProjectsBut like with all other programming languages, you have to deal with a lot of tooling. To have easy access to these tools, I put everything in a makefile so I can build, lint, and run everything from a single place.
Writing an RPC server in GoHey fellow coders, in the last article we learned how to Write Fx Modules and added a logging module into our project. Continuing on the same codebase, we will add support for serving RPC requests. RPC stands for Remote Procedure Call.
Go 2 generics in 5 minutesThe inclusion or not of generics in the Go language has been a long-standing discussion and cause of drama since the first appearance of the language in 2009. Rivers of ink have been poured in long discussions about if generics are good or bad, and if the language needs to support them or not.
go101/go101Go 101 is a book focusing on Go syntax/semantics and all kinds of runtime related things. It tries to help gophers gain a deep and thorough understanding of Go. This book also collects many details of Go and in Go programming.
Go: How Does the Garbage Collector Mark the Memory?The Go garbage collector is responsible for collecting the memory that is not in use anymore. The implemented algorithm is a concurrent tri-color mark and sweep collector. In this article, we will see in detail the marking…
How to setup Golang with VSCodeI have used Golang some years ago, but unfortunately I hadn't tried to do it in a long time and had forgotten all about it.... So I set it up from the beginning with a fresh mind.😊 The environment I used is as follows. macOS Catalina 10.15.5 Visual Studio Code 1.46.
Structure size optimization in Golang (alignment/padding). More effective memory layout (linters).Today I would like to tell you about the alignment of structures in Golang. The capacity of the machines is growing every year. And our computing power allows us to perform increasingly demanding tasks.
Develop A Production Ready REST API in GoWelcome Gophers! In this course, we’ll be covering absolutely everything you need in order to get up and running developing Production-ready REST APIs using Go. Throughout this course, we’ll be looking at how you can build a Comment system for your own sites or projects.
Go Pointers: Why I Use Interfaces (in Go)Emphasis on I and in Go. If you’ve been coding for a while, I probably don’t need to explain all the obvious benefits of interfaces, but I’m going to take just a moment or two to level set before I dive into the more idiosyncratic reasons I use interfaces in Go.
Go: FinalizersGo runtime provides a method runtime.SetFinalizer that allows developers to attach a function to a variable that will be called when the garbage collector sees this variable as garbage ready to be collected since it became unreachable.
Go, HTTP handlers, panic, and deadlocksMaybe the scenario I'm going to describe is just a silly bug no seasoned Go developer would ever make, but it is what it is. I'm not an expert in Go but I do write code in this language from time to time.
Build a Website Using Only the Go Std LibraryThere are quite a few web frameworks available within the Go ecosystem. Yet the advice that is often stated is that the std lib net/http is more than capable and that it’s best to start with that library until you grow out of it.
wuzzInteractive cli tool for HTTP inspection. Note: golang >= 1.10 required.
Golang Tutorial 3 - Golang pointers explained, once and for allThis video is about pointers explained in #golang, along with some basic memory allocation concepts, stack and heap allocations and also how they relate to pointers. It is beginner friendly so I start explaining with the basic syntax, but if you are already familiar with the basics, skip to 04:30.
Extending GObjects From Go and Making Them Available to CWhen I first started writing my GStreamer bindings for go, I had never done C library bindings before. I had written small programs in C for fun, but most of my professional work was either Go, Python, or just pure BASH.
Using SSE in Go web serverStart with adding the right module, that has this functionality already built-in on the server side of program. We will use julienschmidt’s repository again, this time it is module from github.com/julienschmidt/sse. So add the new module and import it.
Golang for Beginners: A Simple Guide to Understanding Basic GoWe are living in an era where technology continues to emerge at a breakneck speed. As 21st century developers, it is crucial for us to learn new coding languages to keep pace with this rapid change as it increases our versatility, widens our competencies and brightens our career prospects.
GoLang: Building a Web ServerWhen you read the term web server, what pops up in your mind? Having worked on Java before I moved on to GoLang, the very first thing that comes to me is Spring and its complex configurations. So, here I welcome you to the world of GoLang where things are as simple as they can be.
My raw notes on Go — Best practices, concurrency, memory and beyondOver the last few months I’ve been doing some deeper research over some topics about Go that I found interesting and wanted to have a deeper knowledge about.
Decorating Go ErrorsGo is powerful and popular — projects such as Kubernetes were implemented in Go. One interesting property of Go is that its multi-value returns capability provides a different error handling approach than other programming languages.
Learning Golang in 24 HoursMalcolm Gladwell popularized the notion that it took 10,000 hours to achieve mastery in any skill. However, it came from a body of research on how much time the top performers of several fields spent in “deliberate training” to achieve their level of skill.
Making your Go app configurableUsing a good settings strategy can make local development and deployment a lot easier. Recently, one of my team members wanted to run a service from a Go repository created by another team member. Instinctively, he downloaded the repository and try to fire it up in his favorite editor.
Achieving concurrency in GoIn computer programming, concurrency is ability of a computer to deal with multiple things at once. For general example, if you are surfing internet in a browser, there might be lot of things happening at once.
Handle an Incoming Call With GoIn this tutorial, we’re going to learn how to handle incoming phone calls using a JSON array of actions called Call Control Objects (NCCOs). This tutorial uses Go and the Voice API.
Go: Thoughts About CobraCobra is one of the most famous projects in the Golang ecosystem. It is simple, efficient, and gets great support from the Go community. Let’s discover it. It is quite easy to understand how internal commands work if you get used to Cobra, andvice versa.
Implement a Periodically Refreshing Cache in Your Golang AppA cache that periodically refreshes in the background is a common pattern that is used in several use cases, but how can we achieve this in Go? In this article, I will guide you through the concepts behind the implementation to help you understand how it works. No text, more code.
4 ways GO is just differentGO is a programming language created by Google back in the late 2000’s. It is statically typed, which means you have type safety like Typescript, it is compiled like its parent, C and it has every modern language’s bells and whistles like memory safety and garbage collection.
Go: How Does a Program Recover?Panics in Go are triggered when the program cannot handle an error properly, such as invalid memory access. It can also be triggered by the developer if the error is unexpected and there is no other way to deal with it.
Error checking and defer in GoAn important rule in Go is that you should always check errors. Most people have no issues with that and are correctly checking all their errors, except when the error might come from a deferred method. This code, for example, is something fairly common in many codebases:
Automate WiFi Hacking with Wifite2Most of the security protocols of WiFi networks can be easily broken or can be easily bypassed by exploiting any vulnerability present. These vulnerabilities can be default Username/Password or anything.
Learn and Use Templates in GoWhile developing several full stack apps over the years, I realized some apps don’t need a full-fledged frontend application running. Most of these apps serve static content with dynamic values fitted here and there.
How to create a CLI in golang with cobraHave you ever wonder why in the world of GUI, CLI still exist? You’ll better understand it when you build one of your own. When you learn golang then it is very often that you’ll come across that ‘golang is great to build cli tools’. This fascinated me too.
Nil in GoThis code will fail to compile as they are trying to compare nil values of two different types.
SSH Recipes in Go — Part OneGo has an amazing standard library and it has a pure-go implementation of SSH. This means that you can use Go to interact with remote SSH servers.
gliderlabs/sshThe Glider Labs SSH server package is dope. —@bradfitz, Go team member This package was built by @progrium after working on nearly a dozen projects at Glider Labs using SSH and collaborating with @shazow (known for ssh-chat).
Visualize Go process metrics in real-timeOne day, it became necessary to have a tool to easily observe resource consumption trends of a Go process. I’m aware that there are tons of APM tools out there; also, Go has enough profiling tools including pprof. I poked around the internet but nothing worked as well as I would like.
Calling Multiple APIs Concurrently in Go (Goroutine and WaitGroup)With so many REST APIs floating around today, you’ll at some point find yourself in a situation where you need to call multiple endpoints to build a proper representation of your business object.
How to create a Golang Web Application using FizzA bit of background before we start the article. When I develop a Python web service I use the Connexion library created by Zalando. It’s a great library which is built on top of Flask. It uses an OpenAPI Specification (OAS) file to handle input validation and routing for you.
Go: How Does a Goroutine Start and Exit?In Go, a goroutine is nothing but a Go structure containing information regarding the running program, such as stack, program counter, or its current OS thread. The Go scheduler deals with that information to give them running time.
Generics are the Generics of GoAbout three years ago, I was working on a pull request approval manager for GitHub written in Go called Checks-Out. While building out the integration layer, I came across a situation where the straightforward approach in Go was overly repetitive.
Go is Boring…And That’s Fantastic!I’ve been working as a professional software engineer for nearly 23 years, and I’ve been writing programs for about 38. In that time, I’ve used a lot of languages.
Bad Go: frivolous SprintfThis is the 3rd in a series of posts about Bad Go — a clickbaity title for posts about Go that I’ve found frustrating because it could just be that little bit better. Better in my mind is often more performant with less impact on GC without being more complex or harder to read.
Go: What is the Unsafe Package?The name of the package could let us know that we should not use it. To understand the reasons that it could be unsafe to use this package, let’s first refer to the documentation: Package unsafe contains operations that step around the type safety of Go programs.
Metaprogram in GoMost modern sites implement some kind of MV* framework, either formally or loosely. If you code a lot, you are likely writing many models (M) over and over, that are mostly similar in structure and only vary in the details of the schema.
Go: Work-Stealing in Go SchedulerCreating goroutines in Go is easy and fast. However, Go can run them, at most, one per core at the same time and need a way to park the other goroutines and make sure the load is well balanced across the processors.
A Go web development eco-system, designed to make your life easier.Please see this blog post for more information https://blog.gobuffalo.io/the-road-to-1-0-requiring-modules-5672c6b015e5. Buffalo uses Gorilla toolkit to manage routes, sessions, cookies...
GoDate.ioGo date format
Go Structs (Part 1)With a regular struct, you define the struct, and then you use that struct definition to declare variables. Anonymous Structs on the other hand lets you create struct-based data-type variables without needing to define the struct. This article is part of the Structs in Go series.
Use Environment Variable in your next Golang ProjectWhen it comes to creating a production-grade application, using the environment variable in the application is de facto. Suppose you have an application with many features and each feature need to access the Database.
Error Handling in Golang with Panic, Defer, and “Recover”This piece is focussed on Error Handling in Golang. We will be talking about simple ways to create and capture custom and runtime Errors in Golang. Golang provides a simple approach to this. Golang provides a simple interface for error.
Build a Simple To-Do List App in GolangI’ve wanted to learn Golang for a long time. According to a Stack Overflow survey, Golang was the third-most wanted programming language in the year 2019. Coming from a Python background, learning a new programming language like Golang gives me a unique perspective on how to write code.
URL (Roundtrip)PathEscape escapes the string so it can be safely placed inside a URL path segment. PathUnescape does the inverse transformation of PathEscape, converting each 3-byte encoded substring of the form "%AB" into the hex-decoded byte 0xAB. It also converts '+' into ' ' (space).
A CUI file manager implemented by GoGoful is a CUI file manager implemented by Go.
A modern HTTP reverse proxy and load balancerTraefik (pronounced traffic) is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy. Traefik integrates with your existing infrastructure components (Docker, Swarm mode, Kubernetes, Marathon, Consul, Etcd, Rancher, Amazon ECS, ...
I Mastered Golang Basics by Solving These 15 Project Euler ProblemsHello. In this article, I would like to show you my learnings while solving the first 15 Project Euler problems in Golang. The solutions for the problems are all available at: First of all, what is Project Euler? Simply put, it is a website with mathematical and computer science problems.
FeaturesSwiss Army Knife Proxy for rapid deployments. Supports multiple operations such as request/response dump, filtering and manipulation via DSL language, upstream HTTP/Socks5 proxy.
REST APIs using go-swagger, Lambda functions, and the API GatewayAWS provides support for Swagger/OpenAPI defined REST APIs as well as a go runtime; however, it is not entirely clear how best to work with these, especially if you’re used to using go-swagger for go REST APIs in a non-AWS context.
An Ordered Map in GoAn ordered map (also called a linked hash map in Java) is a data structure that allows amortized O(1) for access and mutation just like a map, but the elements maintain their order. For this I created the github.com/elliotchance/orderedmap package. Here is some basic usage:
Understanding Interfaces in GoInterfaces might seem like a strange concept to newcomers in programming, and to programmers who have not used interfaces because they were either never too confident about them, or maybe because the tools they have used so far did not rely on using interfaces much.
Immutability in GolangThe concept of immutability is very simple. After an object (or struct) is created, it can never be changed. It’s immutable. Although the concept seems simple, it’s not always easy to use it or benefit from it.
Anatomy of methods in GoEven Go does not provide classes, we can use structures to create objects as we have learned in the previous tutorial. But in OOP, classes have properties (fields) as well as behaviors (methods) and so far we have only learned about properties of a struct that are structure fields.
A Tour of Go 1.16's io/fs packageThe upcoming Go 1.16 release has a lot of exciting updates in it, but my most anticipated addition to the Go standard library is the new io/fs and testing/testfs packages. Go’s io.Reader and io.Writer interfaces, along with os.
Go: How to Reduce Lock Contention with the Atomic PackageGo provides memory synchronization mechanisms such as channel or mutex that help to solve different issues. In the case of shared memory, mutex protects the memory against data races.
Context in Golang!Applications in golang use Contexts for controlling and managing very important aspects of reliable applications, such as cancellation and data sharing in concurrent programming. This may sound trivial but in reality, it’s not that so.
Naming Conventions in Go: Short but DescriptiveThat’s not a funny joke. Writing is easy, but reading is painful. Do you ever find yourself wondering what a certain variable refers to or what the purpose of a certain package is? Well, that’s why we need rules and conventions.
A New, Simpler Way to Do Dependency Injection in GoDependency injection (DI) is a great thing. Even if you haven’t heard of the term, it’s likely that you have already used it. This article assumes zero existing knowledge of DI. However, a basic understanding of Go.
Tools for implementing a Golang API server with auto-generated code and documentation, grpc-gatewayOpenAPI is a formalized specification and a complete framework for describing, creating, using, and visualizing REST web services. The goal is to allow client systems and documentation to synchronize their updates with changes on the server.
Use of synchronization techniques in GolangGolang synchronizes multiple goroutines via channels and sync packages to prevent multiple goroutines from competing for data. Due to the data competition problem, it is necessary to synchronize multiple goroutines concurrently, so we need to understand what data competition is before that.
µjson — A Minimal JSON Parser and Transformer in Goµjson is a minimal JSON parser and transformer that works on unstructured (and trusted) JSON. It works by parsing input and calling the given callback function when encountering each item.
What is the best IDE for developing in Golang?You’ve done it. You’ve looked into Golang, and you’re convinced that it fits your use case — or maybe you just want to get started and code in your own local environment instead of an online playground.
Go Modules with Private Git RepositoriesModules have greatly improved the dependency management process in Go. If you are new to Go Modules, and you would like to read more about how to get started, check out the official documentation.
Go: Should I Use a Pointer instead of a Copy of my Struct?For many Go developers, the systematic use of pointers to share structs instead of the copy itself seems the best option in terms of performance. In order to understand the impact of using a pointer rather than a copy of the struct, we will review two use cases.
Go: Concurrency & Scheduler AffinitySwitching a goroutine from an OS thread to another one has a cost and can slow down the application if it occurs too often. However, through time, the Go scheduler has addressed this issue. It now provides affinities between the goroutines and the thread when working concurrently.
The Top 10 Most Common Mistakes I’ve Seen in Go ProjectsFollowing the success of this post, I had in mind that such information could be a good fit for the book. Hence, here‘s my future book: 100 Go Mistakes. It will be published in 2022 but is already available as a MEAP (Manning Early Access Program):
But how, exactly, databases use mmap?In a previous post Discovering and exploring mmap using Go, we talked about how databases have a major problem to solve, which is: how to deal with data stored in disk that is bigger than the available memory.
De-ofuscating GoLang FunctionsGoLang[8] presents an excellent opportunity for malware developers to create tools that present a challenge to malware researchers and reverse engineers while at the same time coming out of the box capable of cross compiling across various architectures.
6 Tips for Using Strings in GoIf you are coming to Go from another language like Ruby or Python there are a lot of changes to take in, and many of these revolve around the string type. Below is a list of some quick tips that answered questions I had during my first few weeks using Golang.
sync.WaitGroupThe short answer is that is a bit clearer when we don’t care about the data being returned from the goroutine. It signifies to other developers that we just want to wait for a group of goroutines to complete, whereas a channel communicates that we are interested in results from those goroutines.
Go: Multiple Errors ManagementError management in Go is always prone to debate and a recurrent topic in the annual survey about the biggest challenges developers are facing when using Go.
Managing groups of gorutines in GoThis is a brief description of the types and patterns in go used to manage groups of concurrent goroutines that I find myself using daily. Starting with the built in wait group, working our way to error group and beyond. It vaguely follows my own path of discovering these.
Implementing Golang Interfaces; Like a BossTL;DR impl is a pretty handy tool for implementing interfaces in Go. Interfaces in Go provide a pretty awesome way to write reusable code.
Top 3 Resources For Learning GoLang in 2021I know I am a bit late to the game here, with Go being over 10 years old, but the main reason I am learning Go is that it's the language used here at Earthly. Why should you learn Go though?  The big reason is that the cloud world seems to be running on Go.
Why Interface, and when.Coming from a C background, I did not understand the importance of interfaces at first, but as it turns out, in some way, interfaces can make object oriented programming a lot easier.
A Proposal for Adding Generics to GoWe’ve filed a Go language change proposal to add support for type parameters for types and functions, permitting a form of generic programming. Generics can give us powerful building blocks that let us share code and build programs more easily.
Go: Understand the Empty InterfaceAn empty interface can be used to hold any data and it can be a useful parameter since it can work with any type. To understand how an empty interface works and how it can hold any type, we should first understand the concept behind the name.
Metaprogram in GoMost modern sites implement some kind of MV* framework, either formally or loosely. If you code a lot, you are likely writing many models (M) over and over, that are mostly similar in structure and only vary in the details of the schema.
A curated list of awesome Go frameworks, libraries and softwareWe have no monthly cost, but we have employees working hard to maintain the Awesome Go, with money raised we can repay the effort of each person involved! All billing and distribution will be open to the entire community. A curated list of awesome Go frameworks, libraries and software.
A Foray Into Go Assembly Programming · Scott MansfieldThis blog post started last August when I was integrating the Spectator PercentileTimer concept into the metrics library in Rend so we could get better cross-fleet latency percentiles.
Packet Capture, Injection, and Analysis with GopacketUPDATE: My book, Security with Go, is now published. If you found this page helpful you should check out the book. It contains 14 chapters with various red and blue team topics covered. The gopacket package provides a Go wrapper for libpcap written in C.
Go ChallengesHi, I’m Elliot the curator of these Go programming challenges! These interactive Go challenges have been designed so that they can help familiarize you with the fundamental Go syntax and also help to introduce some Computer Science and Math topics.
go-interface-examplesSome examples of using Go interfaces to make cleaner, more testable code. These assume general familiarity with Go syntax and the ability to write simple programs. If you haven't already, take a tour of Go! You'll be introduced to interfaces there. You should also read Effective Go.
A Concise Guide to the Latest Go Generics Draft DesignRecently, the Go team announced an updated draft design for their Generics in Go proposal. It goes into a lot of details about why certain decisions were made, implementation details, etc.
How to handle signals with Go to graceful shutdown HTTP serverIn this article we are going to learn how to handle os incoming signals for performing graceful shutdown of http server. To do so we are going to take advantage of os/signal package. Signals are primarily used on Unix-like systems.
Just found that golang has a gopher design guide.I love that designers have so many times about the characters they create, even if they usually are static and seen in limited context. Our main illustrator at Hopper but together an amazing style guide about our bunny mascots as well as some other characters.
An intro to Go for non-Go developersSummary: I’ve presented an introduction to Go a few times for developers who are new to the language – this is that talk serialized as a technical article. It looks at why you might want to use Go, and gives a brief overview of the standard library and the language itself.
Implementing Stack in GoIn computer science, a stack is an abstract data type that serves a collection of elements that are inserted and removed according to the LIFO (last-in, first-out) principle. Which means the last element you put in the stack is the first you take out.
Unexpected Golang behaviorsThis small site is oriented to developers learning golang that want to see the unexpected, at least for a newcomer, behaviors in the language. This examples expect that reader is familiar with the language, if you’re not familiar with it, you should complete the Go by Example tutorial.
Create versatile Microservices in Golang : part 1 of 10 part seriesIf you are finding this content useful, especially if you're using an ad-blocker (who can blame you). Please consider chucking me a couple of quid for my time and effort.
Exploring container package in Go (list, ring and heap)It’s really difficult to read on mobile just FYI, but I’ll read it later on the comp. Thanks for reading it. Is the text too big or the code? I'm looking at it and I'm guessing its the code. Its the monaco editor for react. I'll see what I can do about it.
Basic Go GitHub repository template.I try to make it minimalistic but also ensure that it covers most of the usual build workflows out-of-the-box. That is why I decided to use stuff like golangci-lint, goimports, goreleaser. I really try to be very careful when adding any new feature/dependency.
How do you browse large GO codebaseSo I am reading Kubernetes codebase. It is so large. Are there any tools to which can help me how functions interact with each other and what is the code flow. Thanks everyone for your suggestion. I looked into goland it seems nice.
How to Write a CLI With “Just Enough” ArchitectureThis lines up pretty well with how I write CLIs! Then I decided it was better to create my own package to handle subcommands while using Go-style flags: https://github.com/gbrlsnchs/cli. I'm only sharing it here because you, like me, prefer subcommands over cobra. I think you might like it.
Phil Wadler: Featherweight Go - YouTube151Posted by1 year agoArchived youtube.com/watch?...
How to Write a Lexer in GoA lexer, which is also sometimes referred to as a scanner, reads a source program and converts the input into what is known as a token stream. This is a very important step in compilation since these tokens are used by the parser to create an AST (Abstract Syntax Tree).
GortasGortas (Golang Authentication Service) is an API based authentication service, allows adding authentication to your site or service with minimum efforts. Gortas supports multiple authentication methods across various data sources.
Big File Uploader :- Upload big file by chunking the file using goroutines and channelHi community,I have been learning golang for some time after office hours. I love the language. I have written a simple file uploader which writes the file(any type) onto disk. I would love a code review and feedback from the community.
Learn Golang by building a fintech banking app - Lesson3: User registrationIn the third lesson of the Golang course, I will show you how to build user registration in Golang. Our project is going bigger, so we need some refactoring In the third lesson of the Golang course, I will show you how to build user registration in Golang.
Source code for progapanda.org: a severely over-engineered backend developer's personal website built with tview and websockets [issue help wanted!]docker: Cannot connect to the Docker daemon at tcp://127.0.0.1:2376. Is the docker daemon running?. See 'docker run --help'.
Writing a basic API mask using Go and GraphQLThis is a short tutorial on how to write an API mask in Go, that uses Graphql to go out and make multiple calls to other APIs. Repo: https://github.com/irateswami/goGraphQL Json to Go struct: https://mholt.github.io/json-to-go/
Can someone help me understand Go Get?I started learning go(which I really like). Im reading the book "The Go Programming Language" which is the K&R of Go but the book is really hard to read and Im having trouble understanding how go get works. The other answers aren't wrong but maybe incomplete.
HTTP Adaptive Streaming video player written in golangWe've created a headless video player and a testbed framework for the evaluation of HTTP Adaptive Streaming (HAS) algorithms, protocols and so much more... We've had a lot of fun writing this HAS video player, over the last year. Hope you enjoy it
Go RabbitMQ Beginners TutorialPress J to jump to the feed.
Digging deeper into the analysis of Go-codeThe analysis of source code at the syntactic level can help you with your coding in a variety of ways. For that, the text is almost always converted to AST first to make it easier to handle in most languages.
Writing an API using GolangI am extremely new to Golang and I have been using a Udemy course to learn about the language. I am starting a new job as a back-end developer and my first task is to create an API using Golang. If anyone has any good guides/youtubes to throw my way that would be great.
Go and CPU CachesAccording to Jackie Stewart, a three-time world champion F1 driver, having an understanding of how a car works made him a better pilot. Martin Thompson (the designer of the LMAX Disruptor) applied the concept of mechanical sympathy to programming.
Robust gRPC communication on Google Cloud Run (but not only!)7Posted by4 hours ago threedots.tech/post/r...
Diving into Go by building a CLI application14Posted by3 hours ago eryb.space/2020/0...
Vim as a Go (Golang) IDE using LSP and vim-goIt is 2019 and there are many great ways to write Go. Goland is available for Intellij users, Visual Studio Code (VSCode) is an incredibly enjoyable editor / IDE, and of course, Vim. I am no Vim-purist, I think if you are more productive in a different tool you should use it.
Go interfaces, the tricky partsDoes this Go snippet compile, and if not, why? It doesn't compile (playground). Surprisingly, although User implements Named, and the getName call is fine, the getNames(users) call is a type error.