code: func (f *SourceFile) FormatCode() error {
  	// Parse file into AST
  	fset := token.NewFileSet()
  	file, err := parser.ParseFile(fset, f.Abs(), nil, parser.ParseComments)
  	if err != nil {
  		content, _ := ioutil.ReadFile(f.Abs())
  		var buf bytes.Buffer
  		scanner.PrintError(&buf, err)
  		return fmt.Errorf("%s\n========\nContent:\n%s", buf.String(), content)
  	}
  	// Clean unused imports
  	imports := astutil.Imports(fset, file)
  	for _, group := range imports {
  		for _, imp := range group {
  			path := strings.Trim(imp.Path.Value, `"`)
  			if !astutil.UsesImport(file, path) {
  				if imp.Name != nil {
  					astutil.DeleteNamedImport(fset, file, imp.Name.Name, path)
  				} else {
  					astutil.DeleteImport(fset, file, path)
  				}
  			}
  		}
  	}
  	ast.SortImports(fset, file)
  	// Open file to be written
  	w, err := os.OpenFile(f.Abs(), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm)
  	if err != nil {
  		return err
  	}
  	defer w.Close()
  	// Write formatted code without unused imports
  	return format.Node(w, fset, file)
  }
docs: // FormatCode performs the equivalent of "goimports -w" on the source file.