如何使用golang更新.yaml文件中键的值?

How to update the value of a key in a yaml file using go language?

To update the value of a key in a yaml file

  1. You need to deserialize(means store []byte array to go object) yaml file content
  2. Then Update what you expect
  3. Finally serialize (means store go object to []byte array) and rewrite into file

Ref: https://github.com/go-yaml/yaml. That's it!.