Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Use SUSE BCI Golang as the base image
FROM registry.suse.com/bci/golang:1.25

# Install VCS tools and other dependencies
RUN zypper --non-interactive refresh && \
zypper --non-interactive install -y \
git \
mercurial \
subversion \
bzr \
make \
curl \
sudo \
shadow && \
zypper clean --all

# Create a non-root user for development
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN groupadd --gid $USER_GID $USERNAME && \
useradd --uid $USER_UID --gid $USER_GID -m $USERNAME && \
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME

# Set up Go workspace
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH

# Create Go workspace directories with correct permissions
RUN mkdir -p /go/src /go/bin /go/pkg && \
chown -R $USERNAME:$USERNAME /go

# Switch to the non-root user
USER $USERNAME

# Set working directory
WORKDIR /workspace
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "VCS Development Container",
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true
},
"extensions": [
"golang.go"
]
}
},
"postCreateCommand": "go mod download",
"remoteUser": "vscode"
}
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface.
Quick usage:

remote := "https://github.com/Masterminds/vcs"
local, _ := ioutil.TempDir("", "go-vcs")
local, _ := os.TempDir("", "go-vcs")
repo, err := NewRepo(remote, local)

In this case `NewRepo` will detect the VCS is Git and return a `GitRepo`. All of
Expand All @@ -39,6 +39,25 @@ The constructors have the same signature as `NewRepo`.

For more details see [the documentation](https://godoc.org/github.com/Masterminds/vcs).

## Development

### Using Dev Container

This project includes a [development container](https://containers.dev/) configuration that provides a complete development environment with all required version control tools (Git, Mercurial, Subversion, and Bazaar) pre-installed.

To use the dev container:

1. Install [Docker](https://www.docker.com/products/docker-desktop) and [Visual Studio Code](https://code.visualstudio.com/)
2. Install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) for VS Code
3. Open this repository in VS Code
4. When prompted, click "Reopen in Container" (or use the command palette: "Dev Containers: Reopen in Container")

The dev container is based on the SUSE BCI Golang image and includes:
- Go development environment
- Git, Mercurial (hg), Subversion (svn), and Bazaar (bzr)
- Go language server and tools
- All dependencies needed to run tests

## Motivation

The package `golang.org/x/tools/go/vcs` provides some valuable functionality
Expand Down
Loading