-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix parsing for property values containing '=' #18
Open
johlandabee
wants to merge
1
commit into
hooklift:master
Choose a base branch
from
johlandabee:fix-parsing-#17
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
.encoding = "UTF-8" | ||
bios.bootorder = "hdd,cdrom" | ||
checkpoint.vmstate = "" | ||
cleanshutdown = "TRUE" | ||
config.version = "8" | ||
displayname = "generic-ubuntu1804-vmware" | ||
ehci.pcislotnumber = "-1" | ||
ehci.present = "FALSE" | ||
extendedconfigfile = "generic-ubuntu1804-vmware.vmxf" | ||
floppy0.present = "FALSE" | ||
guestos = "ubuntu-64" | ||
guestos.detailed.data = "bitness='64' distroName='Ubuntu' distroVersion='18.04' familyName='Linux' kernelVersion='4.15.0-76-generic' prettyName='Ubuntu 18.04.4 LTS'" | ||
gui.fullscreenatpoweron = "FALSE" | ||
gui.viewmodeatpoweron = "windowed" | ||
hgfs.linkrootshare = "TRUE" | ||
hgfs.maprootshare = "TRUE" | ||
ide0:0.clientdevice = "TRUE" | ||
ide0:0.devicetype = "cdrom-raw" | ||
ide0:0.filename = "auto detect" | ||
ide0:0.present = "TRUE" | ||
isolation.tools.hgfs.disable = "FALSE" | ||
memsize = "2048" | ||
monitor.phys_bits_used = "42" | ||
msg.autoanswer = "true" | ||
numa.autosize.cookie = "20001" | ||
numa.autosize.vcpu.maxpervirtualnode = "2" | ||
numvcpus = "2" | ||
nvme0.present = "FALSE" | ||
nvram = "generic-ubuntu1804-vmware.nvram" | ||
parallel0.autodetect = "FALSE" | ||
parallel0.bidirectional = "" | ||
parallel0.filename = "" | ||
parallel0.present = "FALSE" | ||
parallel0.startconnected = "FALSE" | ||
pcibridge0.pcislotnumber = "17" | ||
pcibridge0.present = "TRUE" | ||
pcibridge4.functions = "8" | ||
pcibridge4.pcislotnumber = "21" | ||
pcibridge4.present = "TRUE" | ||
pcibridge4.virtualdev = "pcieRootPort" | ||
pcibridge5.functions = "8" | ||
pcibridge5.pcislotnumber = "22" | ||
pcibridge5.present = "TRUE" | ||
pcibridge5.virtualdev = "pcieRootPort" | ||
pcibridge6.functions = "8" | ||
pcibridge6.pcislotnumber = "23" | ||
pcibridge6.present = "TRUE" | ||
pcibridge6.virtualdev = "pcieRootPort" | ||
pcibridge7.functions = "8" | ||
pcibridge7.pcislotnumber = "24" | ||
pcibridge7.present = "TRUE" | ||
pcibridge7.virtualdev = "pcieRootPort" | ||
powertype.poweroff = "soft" | ||
powertype.poweron = "soft" | ||
powertype.reset = "soft" | ||
powertype.suspend = "soft" | ||
proxyapps.publishtohost = "FALSE" | ||
remotedisplay.vnc.enabled = "FALSE" | ||
remotedisplay.vnc.ip = "127.0.0.1" | ||
remotedisplay.vnc.port = "5904" | ||
replay.filename = "" | ||
replay.supported = "FALSE" | ||
sata0.present = "FALSE" | ||
scsi0.pcislotnumber = "16" | ||
scsi0.present = "TRUE" | ||
scsi0.virtualdev = "lsilogic" | ||
scsi0:0.filename = "generic-ubuntu1804-vmware.vmdk" | ||
scsi0:0.present = "TRUE" | ||
scsi0:0.redo = "" | ||
serial0.autodetect = "FALSE" | ||
serial0.filename = "" | ||
serial0.filetype = "" | ||
serial0.pipe.endpoint = "" | ||
serial0.present = "FALSE" | ||
serial0.startconnected = "FALSE" | ||
serial0.trynorxloss = "" | ||
serial0.yieldonmsrread = "" | ||
softpoweroff = "FALSE" | ||
sound.autodetect = "TRUE" | ||
sound.filename = "-1" | ||
sound.present = "FALSE" | ||
sound.startconnected = "FALSE" | ||
svga.guestbackedprimaryaware = "TRUE" | ||
svga.vramsize = "134217728" | ||
tools.synctime = "TRUE" | ||
tools.upgrade.policy = "upgradeAtPowerCycle" | ||
toolsinstallmanager.updatecounter = "1" | ||
usb.pcislotnumber = "-1" | ||
usb.present = "FALSE" | ||
uuid.action = "create" | ||
uuid.bios = "56 4d fc 04 54 ab 8e 06-3c c5 a6 4d f9 c8 bc 5a" | ||
uuid.location = "56 4d fc 04 54 ab 8e 06-3c c5 a6 4d f9 c8 bc 5a" | ||
virtualhw.productcompatibility = "hosted" | ||
virtualhw.version = "12" | ||
vmci0.id = "1861462628" | ||
vmci0.pcislotnumber = "35" | ||
vmci0.present = "TRUE" | ||
vmotion.checkpointfbsize = "134217728" | ||
vmotion.checkpointsvgaprimarysize = "134217728" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a
splitN
would do it, no need for the regular expression unless I'm missing something here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is an example: https://play.golang.org/p/tCDvzaz_Hjg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that should do it. Didn't think of SplitN. Nice thing about the regular expression is you don't need to check for comments, empty values or unquote separately. That is assuming there are never values without quotes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are also harder to maintain, more inefficient and often come with unexpected side effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it might not be as efficient, but less code also leaves less margin for error. I don't necessarily agree on the maintainability or side effect aspect, but I can change the PR if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, it is another reason why I prefer using
strings.SplitN()
, it solves the problem with the least amount of code involved.