mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
21 lines
308 B
Go
21 lines
308 B
Go
package common
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func GetLine(path string, line int) (string, error) {
|
|
path = path[len("file://"):]
|
|
readBytes, err := os.ReadFile(path)
|
|
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
// Split file into lines
|
|
lines := strings.Split(string(readBytes), "\n")
|
|
|
|
return lines[line], nil
|
|
}
|