Skip to content

Add support for the multiple code sources#10

Merged
Vladyslav-Kuksiuk merged 15 commits intomasterfrom
add-multi-root-fragmentation
Mar 23, 2026
Merged

Add support for the multiple code sources#10
Vladyslav-Kuksiuk merged 15 commits intomasterfrom
add-multi-root-fragmentation

Conversation

@Vladyslav-Kuksiuk
Copy link
Copy Markdown
Contributor

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk commented Mar 11, 2026

This PR provides support for specifying multiple code sources for the embedding with the following config syntax:

code-path: 
  - name: examples
    path: path/to/code/root1
  - name: production
    path: path/to/code/root2

It is still possible to specify a single code-path, as before, for backward compatibility.

Note: When named paths are used, it is necessary to specify their names in the embedding instructions:

<embed-code file="$PATH_NAME/path/to/file"></embed-code>

Do not forget the dollar sign ($) before the path name.

Resolves this issue.

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk self-assigned this Mar 11, 2026
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk marked this pull request as ready for review March 11, 2026 16:29
@alexander-yevsyukov
Copy link
Copy Markdown
Contributor

@Vladyslav-Kuksiuk,

Can we have it as "$PATH_NAME as requested in the issue? That is, with the leading dollar sign.

The reason for this is to clearly separate straight paths with those having a named prefix.

Copy link
Copy Markdown
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments and questions.

for _, path := range paths {
isPathSet, err := validatePathSet(path.Path)
if err != nil {
return true, fmt.Errorf("the given path `%s` does not exist", path)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have these error messages starting from lowercase and not ending with a period?
Clearly, these text are English sentences and should be formatted as such.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a Go best practice: https://tip.golang.org/wiki/Errors

Even IntelliJ IDEA highlights errors that start with a capital letter or end with a period as warnings.

}
if strings.ContainsAny(path.Name, ` *?:"<>|`) {
return true, fmt.Errorf("the given code path name `%s` "+
"is not a valid name for the folder", path.Name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please tell why it is not a valid path name. Otherwise people would have to guess.

var warnLines []string
for name, ps := range nameDuplicates {
if len(ps) > 1 {
warnLines = append(warnLines, "- "+name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Go have an auto-formatting linter? The reason for asking is that we don't have space characters around + here and below. But we do in other places.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it, IntelliJ IDEA uses gofmt by default, and this behavior is an issue: golang/go#34426.

I can add spaces, but IDEA will remove them during reformatting.

@Vladyslav-Kuksiuk
Copy link
Copy Markdown
Contributor Author

@Vladyslav-Kuksiuk,

Can we have it as "$PATH_NAME as requested in the issue? That is, with the leading dollar sign.

The reason for this is to clearly separate straight paths with those having a named prefix.

@alexander-yevsyukov Done.

Copy link
Copy Markdown
Collaborator

@dmytro-kashcheiev dmytro-kashcheiev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vladyslav-Kuksiuk LGTM wtih minor comments.

Copy link
Copy Markdown
Contributor

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from improve-console-output to master March 23, 2026 11:29
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk merged commit 0a95c2e into master Mar 23, 2026
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk deleted the add-multi-root-fragmentation branch March 23, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to reference production code via a relative path

3 participants