Skip to content

Commit 58432cb

Browse files
committed
internal/postgres: remove uses of modules.deprecated_comment
The deprecated_column in the modules table has been superseded by the information in the latest_module_versions table. For golang/go#43265 Change-Id: Ib53e0b295a3edf8e807ff825b36baa6701b927b1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/309610 Trust: Jonathan Amsterdam <[email protected]> Run-TryBot: Jonathan Amsterdam <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Julie Qiu <[email protected]>
1 parent 0861263 commit 58432cb

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

internal/postgres/details.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ func (db *DB) GetNestedModules(ctx context.Context, modulePath string) (_ []*int
3131
m.commit_time,
3232
m.redistributable,
3333
m.has_go_mod,
34-
m.deprecated_comment,
3534
m.source_info
3635
FROM
3736
modules m
@@ -139,7 +138,6 @@ func (db *DB) GetModuleInfo(ctx context.Context, modulePath, resolvedVersion str
139138
commit_time,
140139
redistributable,
141140
has_go_mod,
142-
deprecated_comment,
143141
source_info
144142
FROM
145143
modules
@@ -193,18 +191,11 @@ func (s jsonbScanner) Scan(value interface{}) (err error) {
193191

194192
// scanModuleInfo constructs an *internal.ModuleInfo from the given scanner.
195193
func scanModuleInfo(scan func(dest ...interface{}) error) (*internal.ModuleInfo, error) {
196-
var (
197-
mi internal.ModuleInfo
198-
depComment *string
199-
)
194+
var mi internal.ModuleInfo
200195
if err := scan(&mi.ModulePath, &mi.Version, &mi.CommitTime,
201-
&mi.IsRedistributable, &mi.HasGoMod, &depComment, jsonbScanner{&mi.SourceInfo}); err != nil {
196+
&mi.IsRedistributable, &mi.HasGoMod, jsonbScanner{&mi.SourceInfo}); err != nil {
202197
return nil, err
203198
}
204-
if depComment != nil {
205-
mi.Deprecated = true
206-
mi.DeprecationComment = *depComment
207-
}
208199
return &mi, nil
209200
}
210201

internal/postgres/insert_module.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,7 @@ func insertModule(ctx context.Context, db *database.DB, m *internal.Module) (_ i
222222
if err != nil {
223223
return 0, err
224224
}
225-
var (
226-
moduleID int
227-
depComment *string
228-
)
229-
if m.Deprecated {
230-
depComment = &m.DeprecationComment
231-
}
225+
var moduleID int
232226
err = db.QueryRow(ctx,
233227
`INSERT INTO modules(
234228
module_path,
@@ -240,9 +234,8 @@ func insertModule(ctx context.Context, db *database.DB, m *internal.Module) (_ i
240234
source_info,
241235
redistributable,
242236
has_go_mod,
243-
deprecated_comment,
244237
incompatible)
245-
VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)
238+
VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)
246239
ON CONFLICT
247240
(module_path, version)
248241
DO UPDATE SET
@@ -258,7 +251,6 @@ func insertModule(ctx context.Context, db *database.DB, m *internal.Module) (_ i
258251
sourceInfoJSON,
259252
m.IsRedistributable,
260253
m.HasGoMod,
261-
depComment,
262254
version.IsIncompatible(m.Version),
263255
).Scan(&moduleID)
264256
if err != nil {

internal/postgres/version.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ func getPathVersions(ctx context.Context, db *DB, path string, versionTypes ...v
5555
m.commit_time,
5656
m.redistributable,
5757
m.has_go_mod,
58-
m.deprecated_comment,
5958
m.source_info
6059
FROM modules m
6160
INNER JOIN units u

0 commit comments

Comments
 (0)