Golang : Rename file

Tags : golang rename

No File I/O operations will be complete without the capability to rename file.

Renaming a file in Go is easy. This short tutorial will demonstrate how to rename a file.


 package main

  import (

  func main() {

 err :=  os.Rename("old_file", "new_file")

 if err != nil {

Reference :


  See also : Golang : Delete file

Tags : golang rename

By Adam Ng

IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.