-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Introduce Source object in deployment projects and render per so…
…urce id This fixes issues where multiple included git projects would render into the same directory.
- Loading branch information
Showing
6 changed files
with
59 additions
and
22 deletions.
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
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,29 @@ | ||
package deployment | ||
|
||
import ( | ||
"fmt" | ||
"sync" | ||
) | ||
|
||
type Source struct { | ||
id string | ||
dir string | ||
} | ||
|
||
func NewSource(dir string) Source { | ||
return Source{ | ||
id: getNextSourceId(), | ||
dir: dir, | ||
} | ||
} | ||
|
||
var nextSourceId int | ||
var nextSourceIdMutex sync.Mutex | ||
|
||
func getNextSourceId() string { | ||
nextSourceIdMutex.Lock() | ||
defer nextSourceIdMutex.Unlock() | ||
id := fmt.Sprintf("%d", nextSourceId) | ||
nextSourceId += 1 | ||
return id | ||
} |
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