Skip to content
Snippets Groups Projects
Commit 04f89843 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix(gomod): handle quoted dependencies

parent c3bf02ab
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,9 @@ module.exports = { ...@@ -7,7 +7,9 @@ module.exports = {
}; };
function getDep(lineNumber, match) { function getDep(lineNumber, match) {
const [, depName, currentValue] = match; const [, , currentValue] = match;
let [, depName] = match;
depName = depName.replace(/"/g, '');
const dep = { const dep = {
lineNumber, lineNumber,
depName, depName,
......
...@@ -55,7 +55,7 @@ require ( ...@@ -55,7 +55,7 @@ require (
golang.org/x/net v0.0.0-20180811021610-c39426892332 golang.org/x/net v0.0.0-20180811021610-c39426892332
golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0 golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0
golang.org/x/text v0.3.0 golang.org/x/text v0.3.0
gopkg.in/src-d/go-billy.v4 v4.2.0 "gopkg.in/src-d/go-billy.v4" v4.2.0
gopkg.in/src-d/go-git.v4 v4.0.0-20180807092216-43d17e14b714 gopkg.in/src-d/go-git.v4 v4.0.0-20180807092216-43d17e14b714
gopkg.in/warnings.v0 v0.1.2 gopkg.in/warnings.v0 v0.1.2
gopkg.in/yaml.v2 v2.2.1 gopkg.in/yaml.v2 v2.2.1
......
...@@ -12,6 +12,73 @@ require gopkg.in/russross/blackfriday.v2 v2.0.0 ...@@ -12,6 +12,73 @@ require gopkg.in/russross/blackfriday.v2 v2.0.0
" "
`; `;
exports[`manager/gomod/update updateDependency replaces quoted multiline 1`] = `
"module github.com/jesseduffield/lazygit
require (
github.com/aws/aws-sdk-go v1.15.21
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
github.com/davecgh/go-spew v1.1.0
github.com/emirpasic/gods v1.9.0
github.com/fatih/color v1.7.0
github.com/fsnotify/fsnotify v1.4.7
github.com/go-ini/ini v1.38.2
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/hashicorp/go-cleanhttp v0.0.0-20171218145408-d5fe4b57a186
github.com/hashicorp/go-getter v0.0.0-20180809191950-4bda8fa99001
github.com/hashicorp/go-safetemp v0.0.0-20180326211150-b1a1dbde6fdc
github.com/hashicorp/go-version v1.0.0
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce
github.com/heroku/rollrus v0.0.0-20180515183152-fc0cef2ff331
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
github.com/jesseduffield/go-getter v0.0.0-20180822080847-906e15686e63
github.com/jesseduffield/gocui v0.0.0-20180921065632-03e26ff3f1de
github.com/jesseduffield/termbox-go v0.0.0-20180919093808-1e272ff78dcb
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1
github.com/kevinburke/ssh_config v0.0.0-20180317175531-9fc7bb800b55
github.com/magiconair/properties v1.8.0
github.com/mattn/go-colorable v0.0.9
github.com/mattn/go-isatty v0.0.3
github.com/mattn/go-runewidth v0.0.2
github.com/mgutz/str v1.2.0
github.com/mitchellh/go-homedir v0.0.0-20180801233206-58046073cbff
github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77
github.com/mitchellh/mapstructure v0.0.0-20180715050151-f15292f7a699
github.com/nicksnyder/go-i18n v0.0.0-20180803040939-a16b91a3ba80
github.com/pelletier/go-buffruneio v0.2.0
github.com/pelletier/go-toml v1.2.0
github.com/pkg/errors v0.8.0
github.com/pmezard/go-difflib v1.0.0
github.com/sergi/go-diff v1.0.0
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0
github.com/sirupsen/logrus v1.0.6
github.com/spf13/afero v1.1.1
github.com/spf13/cast v1.2.0
github.com/spf13/jwalterweatherman v0.0.0-20180814060501-14d3d4c51834
github.com/spf13/pflag v1.0.2
github.com/spf13/viper v1.1.0
github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad
github.com/src-d/gcfg/v2 v2.3.0
github.com/stretchr/testify v1.2.2
github.com/stvp/roll v0.0.0-20170522205222-3627a5cbeaea
github.com/tcnksm/go-gitconfig v0.1.2
github.com/ulikunitz/xz v0.5.4
github.com/xanzy/ssh-agent v0.2.0
golang.org/x/crypto v0.0.0-20180808211826-de0752318171
golang.org/x/net v0.0.0-20180811021610-c39426892332
golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0
golang.org/x/text v0.3.0
\\"gopkg.in/src-d/go-billy.v4\\" v4.8.0
gopkg.in/src-d/go-git.v4 v4.0.0-20180807092216-43d17e14b714
gopkg.in/warnings.v0 v0.1.2
gopkg.in/yaml.v2 v2.2.1
)
"
`;
exports[`manager/gomod/update updateDependency replaces two values in one file 1`] = ` exports[`manager/gomod/update updateDependency replaces two values in one file 1`] = `
"module github.com/renovate-tests/gomod1 "module github.com/renovate-tests/gomod1
......
...@@ -97,6 +97,18 @@ describe('manager/gomod/update', () => { ...@@ -97,6 +97,18 @@ describe('manager/gomod/update', () => {
expect(res).not.toEqual(gomod2); expect(res).not.toEqual(gomod2);
expect(res.includes(upgrade.newValue)).toBe(true); expect(res.includes(upgrade.newValue)).toBe(true);
}); });
it('replaces quoted multiline', () => {
const upgrade = {
depName: 'gopkg.in/src-d/go-billy.v4',
lineNumber: 57,
multiLine: true,
newValue: 'v4.8.0',
};
const res = goUpdate.updateDependency(gomod2, upgrade);
expect(res).toMatchSnapshot();
expect(res).not.toEqual(gomod2);
expect(res.includes(upgrade.newValue)).toBe(true);
});
it('replaces major multiline', () => { it('replaces major multiline', () => {
const upgrade = { const upgrade = {
depName: 'github.com/emirpasic/gods', depName: 'github.com/emirpasic/gods',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment