File: fs.go

package info (click to toggle)
golang-github-sourcegraph-go-lsp 0.0~git20200429.219e11d-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 168 kB
  • sloc: makefile: 2
file content (26 lines) | stat: -rw-r--r-- 622 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package lspext

import (
	"os"
	"path"
	"time"
)

// FileInfo is the map-based implementation of FileInfo.
type FileInfo struct {
	Name_ string `json:"name"`
	Size_ int64  `json:"size"`
	Dir_  bool   `json:"dir"`
}

func (fi FileInfo) IsDir() bool        { return fi.Dir_ }
func (fi FileInfo) ModTime() time.Time { return time.Time{} }
func (fi FileInfo) Mode() os.FileMode {
	if fi.IsDir() {
		return 0755 | os.ModeDir
	}
	return 0444
}
func (fi FileInfo) Name() string     { return path.Base(fi.Name_) }
func (fi FileInfo) Size() int64      { return int64(fi.Size_) }
func (fi FileInfo) Sys() interface{} { return nil }