| // Copyright 2021 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // Package internal contains functionality for x/vulndb. |
| "golang.org/x/vulndb/internal/derrors" |
| // IDDirectory is the name of the directory that contains entries |
| // Readfilelines reads and returns the lines from a file. |
| // Whitespace on each line is trimmed. |
| // Blank lines and lines beginning with '#' are ignored. |
| func ReadFileLines(filename string) (lines []string, err error) { |
| defer derrors.Wrap(&err, "ReadFileLines(%q)", filename) |
| f, err := os.Open(filename) |
| line := strings.TrimSpace(s.Text()) |
| if line == "" || strings.HasPrefix(line, "#") { |
| lines = append(lines, line) |