File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -43,18 +43,18 @@ func Handle(coreProject *core.Project) error {
43
43
}
44
44
45
45
// add deepsource at project level
46
- deepSourceCopier := deepsource .NewCopier (coreProject )
47
- if deepSourceCopier != nil {
48
- return errors .New ("deepsource copier is nil" )
46
+ deepSourceCopier , err := deepsource .NewCopier (coreProject )
47
+ if err != nil {
48
+ return errors .New ("deep source copier is nil" )
49
49
}
50
50
if err := deepSourceCopier .CreateDeepSourceFiles (); err != nil {
51
51
log .Errorf ("error while creating deepsource files [" + err .Error () + "]" )
52
52
return err
53
53
}
54
54
55
55
// add README.md at project level
56
- readMeCopier := readme .NewCopier (coreProject )
57
- if readMeCopier != nil {
56
+ readMeCopier , err := readme .NewCopier (coreProject )
57
+ if err != nil {
58
58
return errors .New ("readme copier is nil" )
59
59
}
60
60
if err := readMeCopier .CreateReadMeFile (); err != nil {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ type Copier struct {
17
17
Data map [string ]interface {}
18
18
}
19
19
20
- func NewCopier (project * core.Project ) * Copier {
20
+ func NewCopier (project * core.Project ) ( * Copier , error ) {
21
21
// retrieve project named directory
22
22
//gitPlatformUserName, gitRepositoryName, projectDirectoryName, templatesRootPath string
23
23
// populate map to replace templates
@@ -29,15 +29,15 @@ func NewCopier(project *core.Project) *Copier {
29
29
templatesRootPath , err := utils .GetTemplatesRootPath ("common-templates" )
30
30
if err != nil {
31
31
log .Errorf ("error while getting the project root path [" + err .Error () + "]" )
32
- return nil
32
+ return nil , err
33
33
}
34
34
return & Copier {
35
35
// TODO change this path to constant. Add language specific analysers in a generic way later.
36
36
TemplatesRootPath : templatesRootPath ,
37
37
ProjectDirectoryName : utils .GetProjectDirectoryName (project .Name ),
38
38
GitRepositoryName : project .GitRepositoryName ,
39
39
Data : data ,
40
- }
40
+ }, nil
41
41
}
42
42
43
43
// CreateDeepSourceFiles creates required directory and copies files from language template.
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ type Copier struct {
17
17
Data map [string ]interface {}
18
18
}
19
19
20
- func NewCopier (project * core.Project ) * Copier {
20
+ func NewCopier (project * core.Project ) ( * Copier , error ) {
21
21
// retrieve project named directory
22
22
//gitPlatformUserName, gitRepositoryName, projectDirectoryName, templatesRootPath string
23
23
// populate map to replace templates
@@ -29,15 +29,15 @@ func NewCopier(project *core.Project) *Copier {
29
29
templatesRootPath , err := utils .GetTemplatesRootPath ("common-templates" )
30
30
if err != nil {
31
31
log .Errorf ("error while getting the project root path [" + err .Error () + "]" )
32
- return nil
32
+ return nil , err
33
33
}
34
34
return & Copier {
35
35
// TODO change this path to constant. Add language specific analysers in a generic way later.
36
36
TemplatesRootPath : templatesRootPath ,
37
37
ProjectDirectoryName : utils .GetProjectDirectoryName (project .Name ),
38
38
GitRepositoryName : project .GitRepositoryName ,
39
39
Data : data ,
40
- }
40
+ }, nil
41
41
}
42
42
43
43
// CreateReadMeFile creates required directory and copies files from language template.
You can’t perform that action at this time.
0 commit comments