You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: snapcraft/how-to/go-applications/go-applications.md
+42-14Lines changed: 42 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,22 +22,39 @@ description: |
22
22
feels welcome and included. woke is a text file analysis tool that finds
23
23
places within your source code that contain non-inclusive language and
24
24
suggests replacing them with more inclusive alternatives.
25
-
version: git
26
-
grade: stable
27
-
base: core20
25
+
adopt-info: woke
26
+
base: core22
28
27
29
28
confinement: devmode
30
29
30
+
plugs:
31
+
dot-config-woke:
32
+
interface: personal-files
33
+
read:
34
+
- $HOME/.config/woke.yaml
35
+
- $HOME/.config/woke.yml
36
+
- $HOME/.woke.yaml
37
+
- $HOME/.woke.yml
38
+
31
39
apps:
32
40
woke:
33
41
command: bin/woke
34
42
plugs:
35
43
- home
44
+
- dot-config-woke
45
+
- network
46
+
- removable-media
47
+
36
48
parts:
37
49
woke:
38
50
plugin: go
39
-
source-type: git
51
+
build-snaps: [go/latest/stable]
40
52
source: https://github.com/get-woke/woke
53
+
source-type: git
54
+
override-pull: |
55
+
snapcraftctl pull
56
+
snapcraftctl set-version \
57
+
"$(git describe --long --tags --always --match=v*.*.* | sed 's/v//')"
41
58
```
42
59
43
60
We'll break this file down into its components in the following sections.
@@ -58,14 +75,14 @@ description: |
58
75
feels welcome and included. woke is a text file analysis tool that finds
59
76
places within your source code that contain non-inclusive language and
60
77
suggests replacing them with more inclusive alternatives.
61
-
version: git
78
+
adopt-info: woke
62
79
```
63
80
64
-
The `name` must be unique in the Snap Store. Valid snap names consist of lower-case alphanumeric characters and hyphens. They cannot be all numbers and they also cannot start or end with a hyphen.
81
+
The `name` must be unique in the Snap Store. Valid snap names consist of lowercase alphanumeric characters and hyphens. They cannot be all numbers and they also cannot start or end with a hyphen.
65
82
66
-
By specifying `git` for the version, the current git tag or commit will be used as the version string. Versions carry no semantic meaning in snaps.
83
+
The `summary` cannot exceed 79 characters. You can use a chevron '>' in the `description` key to declare a multi-line description.
67
84
68
-
The `summary` can not exceed 79 characters. You can use a chevron '>' in the `description` key to declare a multi-line description.
85
+
The `adopt-info` keyword is used to import metadata from other sources within the upstream project. This reduces redundancy and ensures consistency. Here, Snapcraft will look within the source repository defined in the `woke` part to find and adopt metadata such as `version`.
69
86
70
87
### Base
71
88
@@ -74,11 +91,11 @@ A base snap is a special kind of snap that provides a run-time environment
74
91
alongside a minimal set of libraries that are common to most applications.
75
92
76
93
```yaml
77
-
base: core20
94
+
base: core22
78
95
```
79
96
80
-
In this example, [core20](https://snapcraft.io/core20) is used as the base for snap building, and is based
81
-
on [Ubuntu 20.04 LTS](http://releases.ubuntu.com/20.04/). See [Base snaps](/t/11198) for more details.
97
+
In this example, [core22](https://snapcraft.io/core22) is used as the base for snap building, and is based
98
+
on [Ubuntu 22.04 LTS](https://releases.ubuntu.com/22.04/). See [Base snaps](/t/11198) for more details.
82
99
83
100
### Security model
84
101
@@ -117,19 +134,30 @@ we only need to use one part for the *woke* source code:
117
134
parts:
118
135
woke:
119
136
plugin: go
120
-
source-type: git
137
+
build-snaps: [go/latest/stable]
121
138
source: https://github.com/get-woke/woke
139
+
source-type: git
140
+
override-pull: |
141
+
snapcraftctl pull
142
+
snapcraftctl set-version \
143
+
"$(git describe --long --tags --always --match=v*.*.* | sed 's/v//')"
122
144
```
123
145
124
146
The `plugin` keyword is used to select a language or technology-specific
125
147
plugin that knows how to perform the build steps for the project.
126
148
In this example, the [go plugin](/t/7818) is used to
127
149
automate the build of this project using the version of Go on the host system.
128
150
151
+
The `build-snaps` keyword specifies a list of snaps that should be available during the build process. Here, using `go/latest/stable` ensures that the latest stable version of the Go snap is available for building the snap package.
152
+
129
153
The `source` keyword points to the source code of the project, which
130
154
can be a local directory or remote Git repository. In this case, it refers to
131
155
the main project repository.
132
156
157
+
The `source-type` keyword indicates that the source is a git repository.
158
+
159
+
The `override-pull` keyword in the `snapcraft.yaml` file allows you to customise the actions taken during the pull step of the build process. The pull step is responsible for fetching the source code from the repository specified in the `source` keyword. By default, Snapcraft handles this step automatically, but `override-pull` lets you define your own commands to extend or replace this behavior. See [Override build steps](https://snapcraft.io/docs/overrides)for more details.
160
+
133
161
### Apps
134
162
135
163
Apps are the commands and services that the snap provides to users. Each key
@@ -156,7 +184,7 @@ to avoid naming conflicts between installed snaps. An example of this would be
156
184
157
185
The confinement of the snap, which was defined in the **Security model** section
158
186
above, can be changed through a set of :term:`interfaces`. In this example,
159
-
the `plugs` keyword is used to specify the interfaces that the snap needs
187
+
the `plugs` keyword specifies the interfaces that the snap needs
160
188
to access.
161
189
162
190
### Building the snap
@@ -219,7 +247,7 @@ $ sudo snap remove woke
219
247
220
248
## Publishing your snap
221
249
222
-
To share your snaps you need to publish them in the Snap Store. First, create an account on [the dashboard](https://dashboard.snapcraft.io/dev/account/). Here you can customise how your snaps are presented, review your uploads and control publishing.
250
+
To share your snaps, you need to publish them in the Snap Store. First, create an account on [the dashboard](https://dashboard.snapcraft.io/dev/account/). Here you can customise how your snaps are presented, review your uploads, and control publishing.
223
251
224
252
You’ll need to choose a unique “developer namespace” as part of the account creation process. This name will be visible by users and associated with your published snaps.
0 commit comments