How to concatenate strings in Golang?

Hi Friends 👋,

Welcome To aGuideHub! ❤️

Today, I’m going to show how do you efficiently concatenate strings in golang, here I will use strings.Builder to access the feature of string concat.

The strings.Builder provide the WriteString() method which we are going to use to concat two or multiple strings.

Well, let’s start today’s tutorial How to concatenate strings in Golang?

Before writing concatenates strings to code, let’s plan out what we are going to do.

  1. Intilize string builder as variable
  2. Use variable with WriteString() method to concat
  3. Print concatenate in golang console.
package main

import (

func main() {
	// It's ready to use from the get-go.
	// You don't need to initialize it.

	var str strings.Builder


In the above example, we have used strings.Builder to concat aGuideHub string char, and it should show in the golang console.

Let’s check the output.

get, concatenate strings, golang

Try it yourself

All the best 👍

Premium Content

You can get all the below premium content directly in your mail when you subscribe us


Portfolio Template

View | Get Source Code

Cheat Sheets

Cheat Sheets Books are basically Important useful notes which we use in our day-to-day life.

I'm working on some more Cheat Sheets book on Jquery, TypeScript, React js and for other languages. I will send it once it's completed.

Stay tuned working on React Js Cheat Sheets Book

Related Posts