Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

Simple golang file which contains examples about file actions in golang. To keep it simple I only used golang's built-in "os" package.


How to test:

  • Rename any file you want to use as "main.go"
  • Type command "go run main.go"

The main.go file contains these file actions:

  • Open file for READ, WRITE, CREATE and APPEND
  • Learn GID and UID of the user
  • Change user of a file with CHOWN
  • Read and print file content
  • Close file
  • Add/append/write new data into a file
  • Change permission of a file with CHMOD
  • Create directory with MKDIR
  • Rename file or directory with RENAME
  • Remove empty file or directory with REMOVE
  • Remove file or directory with any children it contains with REMOVEALL
  • Change working directory with CHDIR
  • Open a directory with OPEN
  • List files in a directory with READDIR
  • Close directory
  • Learn file/directory type
  • Learn temp directory with TEMPDIR
  • Learn file permissions
  • That's all for now...

License

Please use and re-use however you want.

About

Simple examples to show golang file actions

Topics

Resources

Releases

No releases published

Packages

No packages published

Languages