fix(gomod): use go get to generate pseudo versions for digest updates (#4386)

Instead of generating the pseudo version ourselves, replace the existing pseudo version with a digest only and let “go get” massage it into a valid pseudo version.
This commit is contained in:
Rhys Arkins
2019-08-27 19:04:55 +02:00
committed by GitHub
parent d0a32a53f7
commit 31ce47297b
+4 -4
View File
@@ -1,4 +1,3 @@
import { DateTime } from 'luxon';
import { logger } from '../../logger';
import { Upgrade } from '../common';
@@ -57,9 +56,10 @@ export function updateDependency(
{ depName, lineToChange, newDigestRightSized },
'gomod: need to update digest'
);
const currentDateTime = DateTime.local().toFormat('yyyyMMddHHmmss');
const newValue = `v0.0.0-${currentDateTime}-${newDigestRightSized}`;
newLine = lineToChange.replace(updateLineExp, `$1$2${newValue}`);
newLine = lineToChange.replace(
updateLineExp,
`$1$2${newDigestRightSized}`
);
} else {
newLine = lineToChange.replace(updateLineExp, `$1$2${upgrade.newValue}`);
}