MCPcopy Index your code
hub / github.com/coder/coder / userHomeDir

Function userHomeDir

agent/agentssh/agentssh.go:1353–1366  ·  view source on GitHub ↗

userHomeDir returns the home directory of the current user, giving priority to the $HOME environment variable.

()

Source from the content-addressed store, hash-verified

1351// userHomeDir returns the home directory of the current user, giving
1352// priority to the $HOME environment variable.
1353func userHomeDir() (string, error) {
1354 // First we check the environment.
1355 homedir, err := os.UserHomeDir()
1356 if err == nil {
1357 return homedir, nil
1358 }
1359
1360 // As a fallback, we try the user information.
1361 u, err := user.Current()
1362 if err != nil {
1363 return "", xerrors.Errorf("current user: %w", err)
1364 }
1365 return u.HomeDir, nil
1366}
1367
1368// UpdateHostSigner updates the host signer with a new key generated from the provided seed.
1369// If an existing host key exists with the same algorithm, it is overwritten

Callers 3

NewServerFunction · 0.70
sftpHandlerMethod · 0.70
isQuietLoginFunction · 0.70

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected