From the course: Learning the Go Standard Library
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
File information - Go Tutorial
From the course: Learning the Go Standard Library
File information
- [Instructor] The Go package library provides great support for working with files and directories, which is what we're going to focus on in this chapter. So, the OS package gives us a set of functions and types for working with files and directories, and you can see, if I scroll down here a little bit, that there's quite a few functions to find here, some of which we'll see later in the chapter. So, we're going to start off by learning how to inspect basic information of a file or a directory. So, let's go ahead and jump over to our Code Editor. All right, so here in the Editor, in chapter four, for files, in the Start folder, we're going to open up Info and we're going to open up Info_Start. So, let's start off with a basic operation and that's to determine whether a file exists. So to do this, I'm going to define a function named checkFileExists, and so we'll fill this code out here. So, first I'll need to import the modules…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.