Documentation ¶
Overview ¶
Package conf includes configurations related manipulations.
Index ¶
- Constants
- Variables
- func CreateWorkspaceDir(path string)
- func FixedTimeCheckEnv()
- func GetEditorThemes() []string
- func GetGoFmt(userId string) string
- func GetOwner(path string) string
- func GetThemes() []string
- func GetUserWorkspace(userId string) string
- func Load(confPath, confData, confServer, confLogLevel string)
- func UpdateCustomizedConf(userId string)
- type LatestSessionContent
- type Layout
- type Panel
- type User
Constants ¶
const ( // PathSeparator holds the OS-specific path separator. PathSeparator = string(os.PathSeparator) // PathListSeparator holds the OS-specific path list separator. PathListSeparator = string(os.PathListSeparator) // WideVersion holds the current Wide's version. WideVersion = "1.5.3" // CodeMirrorVer holds the current editor version. CodeMirrorVer = "5.1" // UserAgent represents HTTP client user agent. UserAgent = "Wide/" + WideVersion + "; +https://github.com/b3log/wide" HelloWorld = `package main import "fmt" func main() { fmt.Println("Hello, 世界") } ` )
const DockerImageGo = "golang"
Docker image to run user's program
Variables ¶
var Docker bool
Indicates whether Docker is available.
var Users []*User
configurations of users.
var Wide *conf
Wide configurations.
Functions ¶
func CreateWorkspaceDir ¶
func CreateWorkspaceDir(path string)
CreateWorkspaceDir creates (if not exists) directories on the path.
- root directory:{path}
- src directory: {path}/src
- package directory: {path}/pkg
- binary directory: {path}/bin
func FixedTimeCheckEnv ¶
func FixedTimeCheckEnv()
FixedTimeCheckEnv checks Wide runtime enviorment periodically (7 minutes).
Exits process if found fatal issues (such as not found $GOPATH), Notifies user by notification queue if found warning issues (such as not found gocode).
func GetEditorThemes ¶
func GetEditorThemes() []string
GetEditorThemes gets the names of editor themes.
func GetUserWorkspace ¶
GetUserWorkspace gets workspace path with the specified user id, returns "" if not found.
func Load ¶
func Load(confPath, confData, confServer, confLogLevel string)
Load loads the Wide configurations from wide.json and users' configurations from users/{userId}.json.
func UpdateCustomizedConf ¶
func UpdateCustomizedConf(userId string)
UpdateCustomizedConf creates (if not exists) or updates user customized configuration files.
- /static/users/{userId}/style.css
Types ¶
type LatestSessionContent ¶
type LatestSessionContent struct { FileTree []string `json:"fileTree"` // paths of expanding nodes of file tree Files []string `json:"files"` // paths of files of opening editor tabs CurrentFile string `json:"currentFile"` // path of file of the current focused editor tab Layout *Layout `json:"layout"` // UI Layout }
LatestSessionContent represents the latest session content.
type Layout ¶
type Layout struct { Side *Panel `json:"side"` // Side panel SideRight *Panel `json:"sideRight"` // Right-Side panel Bottom *Panel `json:"bottom"` // Bottom panel }
Layout represents the UI layout.
type Panel ¶
type Panel struct { State string `json:"state"` // panel state, "min"/"max"/"normal" Size uint16 `json:"size"` // panel size }
Panel represents a UI panel.
type User ¶
type User struct { Id string Name string Avatar string Workspace string // the GOPATH of this user (maybe contain several paths splitted by os.PathListSeparator) Locale string GoFormat string GoBuildArgsForLinux string GoBuildArgsForWindows string GoBuildArgsForDarwin string FontFamily string FontSize string Theme string Keymap string // wide/vim Created int64 // user create time in unix nano Updated int64 // preference update time in unix nano Lived int64 // the latest session activity in unix nano Editor *editor LatestSessionContent *LatestSessionContent }
User configuration.
func GetUser ¶
GetUser gets configuration of the user specified by the given user id, returns nil if not found.
func (*User) WorkspacePath ¶
WorkspacePath gets workspace path of the user.
Compared to the use of Wide.Workspace, this function will be processed as follows:
- Replace {WD} variable with the actual directory path
- Replace ${GOPATH} with enviorment variable GOPATH
- Replace "/" with "\\" (Windows)