Skip to content

Commit 9c35887

Browse files
authored
Merge pull request #49 from vmarkovtsev/master
Update go.mod
2 parents 9f8957e + 3e40eef commit 9c35887

File tree

884 files changed

+71
-972394
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

884 files changed

+71
-972394
lines changed

.travis.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@ language: go
44

55
go_import_path: gopkg.in/src-d/go-license-detector.v2
66
go:
7-
- 1.9.x
8-
- 1.10.x
9-
- tip
7+
- 1.11.x
8+
- 1.12.x
109

1110
matrix:
1211
fast_finish: true
13-
allow_failures:
14-
- go: tip
1512

1613
before_install:
1714
- go get -v golang.org/x/lint/golint
1815
- go get -v github.com/haya14busa/goverage
1916

2017
install:
21-
- go get -v -t ./...
18+
- export GO111MODULE=on
19+
- go mod vendor
20+
- go build -v ./...
2221

2322
script:
2423
- go vet ./...
@@ -34,29 +33,29 @@ jobs:
3433
include:
3534
- stage: deploy
3635
os: osx
37-
go: 1.10.x
36+
go: 1.12.x
3837
after_success:
39-
- gzip -S .darwin_amd64.gz $GOPATH/bin/license-detector
38+
- gzip -S .darwin_amd64.gz license-detector
4039
script: skip
4140
deploy:
4241
provider: releases
4342
api_key:
4443
secure: $GITHUB_TOKEN
45-
file: "$GOPATH/bin/license-detector.darwin_amd64.gz"
44+
file: "license-detector.darwin_amd64.gz"
4645
skip_cleanup: true
4746
on:
4847
tags: true
4948
- stage: deploy
5049
os: linux
51-
go: 1.10.x
50+
go: 1.12.x
5251
script: skip
5352
after_success:
54-
- gzip -S .linux_amd64.gz $GOPATH/bin/license-detector
53+
- gzip -S .linux_amd64.gz license-detector
5554
deploy:
5655
provider: releases
5756
api_key:
5857
secure: $GITHUB_TOKEN
59-
file: "$GOPATH/bin/license-detector.linux_amd64.gz"
58+
file: "license-detector.linux_amd64.gz"
6059
skip_cleanup: true
6160
on:
6261
tags: true

appveyor.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ version: "{build}"
22
platform: x64
33
image: Visual Studio 2017
44

5-
clone_folder: c:\gopath\src\gopkg.in\src-d\go-license-detector.v2
6-
75
environment:
8-
GOPATH: c:\gopath
6+
GO111MODULE: on
97

108
build_script:
11-
- go version
12-
- go get -v gopkg.in/src-d/go-license-detector.v2/cmd/license-detector
13-
- 7z a c:\gopath\src\gopkg.in\src-d\go-license-detector.v2\license-detector.windows_amd64.zip %GOPATH%\bin\license-detector.exe
9+
- go mod vendor
10+
- go build -v gopkg.in/src-d/go-license-detector.v2/cmd/license-detector
11+
- go test gopkg.in/src-d/go-license-detector.v2/...
12+
- 7z a license-detector.windows_amd64.zip license-detector.exe
1413

1514
artifacts:
1615
- name: license-detector.windows_amd64.zip

go.mod

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ require (
1515
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
1616
github.com/jdkato/prose v1.1.0
1717
github.com/kevinburke/ssh_config v0.0.0-20180127194858-0ff8514904a8 // indirect
18-
github.com/kr/pretty v0.1.0 // indirect
1918
github.com/mitchellh/go-homedir v0.0.0-20161203194507-b8bc1bf76747 // indirect
2019
github.com/montanaflynn/stats v0.0.0-20151014174947-eeaced052adb // indirect
2120
github.com/neurosnap/sentences v1.0.6 // indirect
2221
github.com/pelletier/go-buffruneio v0.2.0 // indirect
2322
github.com/pkg/errors v0.8.0
2423
github.com/pmezard/go-difflib v1.0.0 // indirect
24+
github.com/russross/blackfriday/v2 v2.0.1
2525
github.com/sergi/go-diff v0.0.0-20180205163309-da645544ed44
2626
github.com/shogo82148/go-shuffle v0.0.0-20170808115208-59829097ff3b // indirect
2727
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 // indirect
@@ -32,16 +32,13 @@ require (
3232
golang.org/x/crypto v0.0.0-20180206190813-d9133f546934 // indirect
3333
golang.org/x/exp v0.0.0-20171209012058-072991165226
3434
golang.org/x/net v0.0.0-20180208041118-f5dfe339be1d
35-
golang.org/x/sys v0.0.0-20180202135801-37707fdb30a5 // indirect
3635
golang.org/x/text v0.0.0-20180208041248-4e4a3210bb54
3736
gonum.org/v1/gonum v0.0.0-20180205154402-996b88e8f894
38-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
3937
gopkg.in/neurosnap/sentences.v1 v1.0.6 // indirect
40-
gopkg.in/russross/blackfriday.v2 v2.0.0
41-
gopkg.in/src-d/go-billy-siva.v4 v4.1.0
42-
gopkg.in/src-d/go-billy.v4 v4.1.0
38+
gopkg.in/src-d/go-billy-siva.v4 v4.3.0
39+
gopkg.in/src-d/go-billy.v4 v4.3.0
4340
gopkg.in/src-d/go-git-fixtures.v3 v3.3.0 // indirect
4441
gopkg.in/src-d/go-git.v4 v4.1.0
45-
gopkg.in/src-d/go-siva.v1 v1.1.3 // indirect
42+
gopkg.in/src-d/go-siva.v1 v1.5.0 // indirect
4643
gopkg.in/warnings.v0 v0.1.2 // indirect
4744
)

go.sum

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
21
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
3-
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
42
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
53
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
64
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7-
github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc h1:8WFBn63wegobsYAX0YjD+8suexZDga5CctH4CCTx2+8=
85
github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw=
96
github.com/dgryski/go-minhash v0.0.0-20170608043002-7fe510aff544 h1:54Y/2GF52MSJ4n63HWvNDFRtztgm6tq2UrOX61sjGKc=
107
github.com/dgryski/go-minhash v0.0.0-20170608043002-7fe510aff544/go.mod h1:VBi0XHpFy0xiMySf6YpVbRqrupW4RprJ5QTyN+XvGSM=
11-
github.com/dgryski/go-spooky v0.0.0-20170606183049-ed3d087f40e2 h1:lx1ZQgST/imDhmLpYDma1O3Cx9L+4Ie4E8S2RjFPQ30=
128
github.com/dgryski/go-spooky v0.0.0-20170606183049-ed3d087f40e2/go.mod h1:hgHYKsoIw7S/hlWtP7wD1wZ7SX1jPTtKko5X9jrOgPQ=
139
github.com/ekzhu/minhash-lsh v0.0.0-20171225071031-5c06ee8586a1 h1:/7G7q8SDJdrah5jDYqZI8pGFjSqiCzfSEO+NgqKCYX0=
1410
github.com/ekzhu/minhash-lsh v0.0.0-20171225071031-5c06ee8586a1/go.mod h1:yEtCVi+QamvzjEH4U/m6ZGkALIkF2xfQnFp0BcKmIOk=
15-
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
1611
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
17-
github.com/gliderlabs/ssh v0.1.1 h1:j3L6gSLQalDETeEg/Jg0mGY0/y/N6zI2xX1978P0Uqw=
1812
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
19-
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
2013
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
2114
github.com/hhatto/gorst v0.0.0-20171128071645-7682c8a25108 h1:wWkhJ3fgjH1kk5Sp9mYd1puH4PVEU/k6GcpVp2LIUZw=
2215
github.com/hhatto/gorst v0.0.0-20171128071645-7682c8a25108/go.mod h1:HmaZGXHdSwQh1jnUlBGN2BeEYOHACLVGzYOXCbsLvxY=
@@ -26,23 +19,22 @@ github.com/jdkato/prose v1.1.0 h1:LpvmDGwbKGTgdCH3a8VJL56sr7p/wOFPw/R4lM4PfFg=
2619
github.com/jdkato/prose v1.1.0/go.mod h1:jkF0lkxaX5PFSlk9l4Gh9Y+T57TqUZziWT7uZbW5ADg=
2720
github.com/kevinburke/ssh_config v0.0.0-20180127194858-0ff8514904a8 h1:klRp3/4ivQOL3+RkXTG7Y0inb9Tw6FNsk6xGicemw98=
2821
github.com/kevinburke/ssh_config v0.0.0-20180127194858-0ff8514904a8/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
29-
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
3022
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
3123
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
32-
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
3324
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
3425
github.com/mitchellh/go-homedir v0.0.0-20161203194507-b8bc1bf76747 h1:eQox4Rh4ewJF+mqYPxCkmBAirRnPaHEB26UkNuPyjlk=
3526
github.com/mitchellh/go-homedir v0.0.0-20161203194507-b8bc1bf76747/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
3627
github.com/montanaflynn/stats v0.0.0-20151014174947-eeaced052adb h1:bsjNADsjHq0gjU7KO7zwoX5k3HtFdf6TDzB3ncl5iUs=
3728
github.com/montanaflynn/stats v0.0.0-20151014174947-eeaced052adb/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
38-
github.com/neurosnap/sentences v1.0.6 h1:iBVUivNtlwGkYsJblWV8GGVFmXzZzak907Ci8aA0VTE=
3929
github.com/neurosnap/sentences v1.0.6/go.mod h1:pg1IapvYpWCJJm/Etxeh0+gtMf1rI1STY9S7eUCPbDc=
4030
github.com/pelletier/go-buffruneio v0.2.0 h1:U4t4R6YkofJ5xHm3dJzuRpPZ0mr5MMCoAWooScCR7aA=
4131
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
4232
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
4333
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
4434
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4535
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
36+
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
37+
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
4638
github.com/sergi/go-diff v0.0.0-20180205163309-da645544ed44 h1:UoZTeCJuGZpwXXqamtSHypwjqpyGdR9smB5iMleBDJ8=
4739
github.com/sergi/go-diff v0.0.0-20180205163309-da645544ed44/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
4840
github.com/shogo82148/go-shuffle v0.0.0-20170808115208-59829097ff3b h1:VI1u+o2KZPZ5AhuPpXY0JBdpQPnkTx6Dd5XJhK/9MYE=
@@ -65,25 +57,29 @@ golang.org/x/net v0.0.0-20180208041118-f5dfe339be1d h1:lnO2rP1Eit1fCAJKjYJlnArsH
6557
golang.org/x/net v0.0.0-20180208041118-f5dfe339be1d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
6658
golang.org/x/sys v0.0.0-20180202135801-37707fdb30a5 h1:MF92a0wJ3gzSUVBpjcwdrDr5+klMFRNEEu6Mev4n00I=
6759
golang.org/x/sys v0.0.0-20180202135801-37707fdb30a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
60+
golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9 h1:lkiLiLBHGoH3XnqSLUIaBsilGMUjI+Uy2Xu2JLUtTas=
61+
golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
6862
golang.org/x/text v0.0.0-20180208041248-4e4a3210bb54 h1:a5WocgxWTnjG0C4hZblDx+yonFbQMMbv8yJGhHMz/nY=
6963
golang.org/x/text v0.0.0-20180208041248-4e4a3210bb54/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
7064
gonum.org/v1/gonum v0.0.0-20180205154402-996b88e8f894 h1:7JhBunAsbjfnPGrLN5GFVAqcEs//9Bblx/Fosnaw/TY=
7165
gonum.org/v1/gonum v0.0.0-20180205154402-996b88e8f894/go.mod h1:cucAdkem48eM79EG1fdGOGASXorNZIYAO9duTse+1cI=
72-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
7366
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7467
gopkg.in/neurosnap/sentences.v1 v1.0.6 h1:v7ElyP020iEZQONyLld3fHILHWOPs+ntzuQTNPkul8E=
7568
gopkg.in/neurosnap/sentences.v1 v1.0.6/go.mod h1:YlK+SN+fLQZj+kY3r8DkGDhDr91+S3JmTb5LSxFRQo0=
76-
gopkg.in/russross/blackfriday.v2 v2.0.0 h1:+FlnIV8DSQnT7NZ43hcVKcdJdzZoeCmJj4Ql8gq5keA=
77-
gopkg.in/russross/blackfriday.v2 v2.0.0/go.mod h1:6sSBNz/GtOm/pJTuh5UmBK2ZHfmnxGbl2NZg1UliSOI=
7869
gopkg.in/src-d/go-billy-siva.v4 v4.1.0 h1:m3SYGYbM7LfWUfTE232ZaTAkd0jWwPTWuEnFFO7NvZc=
7970
gopkg.in/src-d/go-billy-siva.v4 v4.1.0/go.mod h1:4wKeCzOCSsdyFeM5+58M6ObU6FM+lZT12p7zm7A+9n0=
71+
gopkg.in/src-d/go-billy-siva.v4 v4.3.0 h1:bin2telR2qmBfHfTb61SboE4M1LjofSN0g6vn4Tmdck=
72+
gopkg.in/src-d/go-billy-siva.v4 v4.3.0/go.mod h1:4wKeCzOCSsdyFeM5+58M6ObU6FM+lZT12p7zm7A+9n0=
8073
gopkg.in/src-d/go-billy.v4 v4.1.0 h1:1kSGpGfLygUB824Wk+fWf2fci5k9gNAQS/J8zZyOO0I=
8174
gopkg.in/src-d/go-billy.v4 v4.1.0/go.mod h1:ZHSF0JP+7oD97194otDUCD7Ofbk63+xFcfWP5bT6h+Q=
82-
gopkg.in/src-d/go-git-fixtures.v3 v3.3.0 h1:AxUOwLW3at53ysFqs0Lg+H+8KSQXl7AEHBvWj8wEsT8=
75+
gopkg.in/src-d/go-billy.v4 v4.3.0 h1:KtlZ4c1OWbIs4jCv5ZXrTqG8EQocr0g/d4DjNg70aek=
76+
gopkg.in/src-d/go-billy.v4 v4.3.0/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk=
8377
gopkg.in/src-d/go-git-fixtures.v3 v3.3.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g=
8478
gopkg.in/src-d/go-git.v4 v4.1.0 h1:ca/w7I2ziAYUrqcyq0Sm065FS1EUQKlzDCm09/RaF0o=
8579
gopkg.in/src-d/go-git.v4 v4.1.0/go.mod h1:CzbUWqMn4pvmvndg3gnh5iZFmSsbhyhUWdI0IQ60AQo=
8680
gopkg.in/src-d/go-siva.v1 v1.1.3 h1:XIb8RKaiHzCbezoJN9t6hIzrWGGXj0Hx7OGtWj9MkOc=
8781
gopkg.in/src-d/go-siva.v1 v1.1.3/go.mod h1:tk1jnIXawd/PTlRNWdr5V5lC0PttNJmu1fv7wt7IZlw=
82+
gopkg.in/src-d/go-siva.v1 v1.5.0 h1:WowvbZTlz0SPoV7WNCGktPSi2yRK78HPyXl7wYqDeHE=
83+
gopkg.in/src-d/go-siva.v1 v1.5.0/go.mod h1:tk1jnIXawd/PTlRNWdr5V5lC0PttNJmu1fv7wt7IZlw=
8884
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
8985
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=

licensedb/filer/filer.go

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"bytes"
66
"io/ioutil"
77
"os"
8+
xpath "path"
89
"path/filepath"
910
"strings"
1011

@@ -36,6 +37,9 @@ type Filer interface {
3637
ReadDir(path string) ([]File, error)
3738
// Close frees all the resources allocated by this Filer.
3839
Close()
40+
// PathsAreAlwaysSlash indicates whether the path separator is platform-independent ("/") or
41+
// OS-specific.
42+
PathsAreAlwaysSlash() bool
3943
}
4044

4145
type localFiler struct {
@@ -99,6 +103,10 @@ func (filer *localFiler) ReadDir(path string) ([]File, error) {
99103

100104
func (filer *localFiler) Close() {}
101105

106+
func (filer *localFiler) PathsAreAlwaysSlash() bool {
107+
return false
108+
}
109+
102110
type gitFiler struct {
103111
root *object.Tree
104112
}
@@ -199,6 +207,10 @@ func (filer *gitFiler) Close() {
199207
filer.root = nil
200208
}
201209

210+
func (filer *gitFiler) PathsAreAlwaysSlash() bool {
211+
return true
212+
}
213+
202214
// FromSiva returns a Filer that allows accessing all the files in a Git repository contained in a Siva file.
203215
// See https://github.com/src-d/go-siva and https://github.com/src-d/go-billy-siva
204216
func FromSiva(path string) (Filer, error) {
@@ -222,13 +234,16 @@ func FromSiva(path string) (Filer, error) {
222234
return nil, errors.Wrapf(err, "unable to list Git references from Siva file %s", path)
223235
}
224236
var head plumbing.ReferenceName
225-
refs.ForEach(func(ref *plumbing.Reference) error {
237+
err = refs.ForEach(func(ref *plumbing.Reference) error {
226238
if strings.HasPrefix(ref.Name().String(), "refs/heads/HEAD/") {
227239
head = ref.Name()
228240
return storer.ErrStop
229241
}
230242
return nil
231243
})
244+
if err != nil {
245+
return nil, errors.Wrapf(err, "failed to iterate over references in Siva file %s", path)
246+
}
232247
return fromGit(repo, head)
233248
}
234249

@@ -269,7 +284,7 @@ func FromZIP(path string) (Filer, error) {
269284
}
270285

271286
func (filer *zipFiler) ReadFile(path string) ([]byte, error) {
272-
parts := strings.Split(path, string(filepath.Separator))
287+
parts := strings.Split(path, string("/"))
273288
node := filer.tree
274289
for _, part := range parts {
275290
if part == "" {
@@ -293,7 +308,7 @@ func (filer *zipFiler) ReadFile(path string) ([]byte, error) {
293308
}
294309

295310
func (filer *zipFiler) ReadDir(path string) ([]File, error) {
296-
parts := strings.Split(path, string(filepath.Separator))
311+
parts := strings.Split(path, string("/"))
297312
node := filer.tree
298313
for _, part := range parts {
299314
if part == "" {
@@ -321,6 +336,10 @@ func (filer *zipFiler) Close() {
321336
filer.arch.Close()
322337
}
323338

339+
func (filer *zipFiler) PathsAreAlwaysSlash() bool {
340+
return true
341+
}
342+
324343
type nestedFiler struct {
325344
origin Filer
326345
offset string
@@ -332,13 +351,29 @@ func NestFiler(filer Filer, prefix string) Filer {
332351
}
333352

334353
func (filer *nestedFiler) ReadFile(path string) ([]byte, error) {
335-
return filer.origin.ReadFile(filepath.Join(filer.offset, path))
354+
var fullPath string
355+
if filer.origin.PathsAreAlwaysSlash() {
356+
fullPath = xpath.Join(filer.offset, path)
357+
} else {
358+
fullPath = filepath.Join(filer.offset, path)
359+
}
360+
return filer.origin.ReadFile(fullPath)
336361
}
337362

338363
func (filer *nestedFiler) ReadDir(path string) ([]File, error) {
339-
return filer.origin.ReadDir(filepath.Join(filer.offset, path))
364+
var fullPath string
365+
if filer.origin.PathsAreAlwaysSlash() {
366+
fullPath = xpath.Join(filer.offset, path)
367+
} else {
368+
fullPath = filepath.Join(filer.offset, path)
369+
}
370+
return filer.origin.ReadDir(fullPath)
340371
}
341372

342373
func (filer *nestedFiler) Close() {
343374
filer.origin.Close()
344375
}
376+
377+
func (filer *nestedFiler) PathsAreAlwaysSlash() bool {
378+
return filer.origin.PathsAreAlwaysSlash()
379+
}

licensedb/internal/processors/markup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55

66
"github.com/hhatto/gorst"
7-
"gopkg.in/russross/blackfriday.v2"
7+
"github.com/russross/blackfriday/v2"
88
)
99

1010
// Markdown converts Markdown to plain text. It tries to revert all the decorations.

vendor/github.com/davecgh/go-spew/LICENSE

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)