Skip to content

xferion.com

Just another XFerion Europe site

Recent Posts

  • Hello world!
  • golang: Check if key exists in map
  • Golang: Reverse ISOWeek, get the date of the first day of ISO week
  • Golang: measure time to execute code
  • Golang create directory

Recent Comments

  1. A WordPress Commenter on Hello world!
  2. Abinhho on Building a Golang web application with Revel
  3. stephan on Golang substr or substring equivalent
  4. a-h on Golang substr or substring equivalent
  5. legends2k on Golang substr or substring equivalent

Archives

  • February 2022
  • July 2015
  • May 2015
  • February 2015
  • January 2015

Categories

  • Go Programming
  • Software Development
  • Uncategorized
  • Web Programming

Tag: os

Golang create directory

Creating a directory from Google Go is simple with the “os” package. See the example below.

Golang create directory example

path := "/folder/to/create"
err := os.MkdirAll(path,0711)

if err != nil {
 log.Println("Error creating directory")
 log.Println(err)
 return
}
Posted on February 7, 2015Categories Go Programming, Software DevelopmentTags go, Golang, google go, kb, osLeave a comment on Golang create directory

Golang delete file

Deleting a file from Google Go (Golang) is simple with the “os” package. See the example below.

Golang delete file example

path := "/path/to/file/to/delete"
err := os.Remove(path)

if err != nil {
  fmt.Println(err)
  return
}
Posted on February 7, 2015Categories Go Programming, Software DevelopmentTags go, Golang, google go, osLeave a comment on Golang delete file
Proudly powered by WordPress
Cleantalk Pixel