Help us understand the problem. What is going on with this article?

Goでsliceに要素追加, slice同士の結合

More than 5 years have passed since last update.

スライスは[]<型>で定義する. 要素の追加はappend

var tasks []string
append(tasks, "todo1")

スライス同士の結合(concat)もappendだが, 第二引数に...を付けるのが妙な感じ.

var tasks_without_due []string
append(tasks, tasks_without_due...)
機能が向上し, 問題が修正されています
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away