d-tux / go-fstab Goto Github PK
View Code? Open in Web Editor NEWSimple fstab parser for Go
License: BSD 3-Clause "New" or "Revised" License
Simple fstab parser for Go
License: BSD 3-Clause "New" or "Revised" License
ubuntu18.04的磁盘信息并没有保存在/etc/fstab
文件
You missed iota in the const list.
Also, it would be better to make them typed constants.
diff --git i/mount.go w/mount.go
index b45513f..e7b6a1a 100644
--- i/mount.go
+++ w/mount.go
@@ -28,16 +28,16 @@ type Mount struct {
PassNo int
}
+type DeviceIdentifierType int
+
const (
- Path = 0
- Label
- UUID
- PartUUID
- PartLabel
+ Path DeviceIdentifierType = iota
+ Label DeviceIdentifierType = iota
+ UUID DeviceIdentifierType = iota
+ PartUUID DeviceIdentifierType = iota
+ PartLabel DeviceIdentifierType = iota
)
-type DeviceIdentifierType int
-
// parseOptions parses the options field into an array of strings
func parseOptions(optionsString string) (options map[string]string) {
options = make(map[string]string)
The name is misleading and leads you to think that it behaves like fmt.Sprintf
, which is not the case.
go vet
actually complains about that.
In order to use it properly, you need to known what arguments are actually passed in what order to fmt.Sprintf
, which you don't unless you read the source; that makes it unsafe to use.
Also, i can't think of any public use case for this.
Let's make it private.
does this library works for windows too ??
go vet
says:
mount.go:185: unrecognized printf verb 'i'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.