profile
viewpoint
ᴜɴᴋɴᴡᴏɴ unknwon @sourcegraph https://unknwon.io ʟɪғᴇ ɪs ᴍᴀɢɪᴄ. ᴄᴏᴅɪɴɢ ɪs ᴀʀᴛ.

unknwon/go-fundamental-programming 7068

《Go 编程基础》是一套针对 Google 出品的 Go 语言的视频语音教程,主要面向新手级别的学习者。

unknwon/go-study-index 3059

Go 语言学习资料索引

unknwon/go-web-foundation 2428

《Go Web 基础》是一套针对 Google 出品的 Go 语言的视频语音教程,主要面向完成《Go 编程基础》教程后希望进一步了解有关 Go Web 开发的学习者。

unknwon/go-rock-libraries-showcases 1469

《Go名库讲解》是一套针对 Google 出品的 Go 语言的第三方库进行评测讲解的集博客、示例与语音视频为一体的综合教程,适合完成学习完成《Go编程基础》教程的学习者。

studygolang/GCTT 1070

GCTT Go中文网翻译组。

unknwon/gowalker 557

Go Walker is a server that generates Go projects API documentation on the fly.

unknwon/com 514

This is an open source project for commonly used functions for the Go programming language.

unknwon/goconfig 510

Package goconfig is a fully functional and comments-support configuration file (.ini) parser.

unknwon/building-web-applications-in-go 491

Go 语言 Web 应用开发系列教程,从新手到双手残废

unknwon/bra 347

Bra (Brilliant Ridiculous Assistant) is a command line utility tool.

Pull request review commentsourcegraph/sourcegraph

e2e: small fixes from 3.13 regression testing runs

 describe('External services GUI', () => {                     "token": ${JSON.stringify(config.gitHubToken)},                     "repos": ${JSON.stringify(repoSlugs)},                     "repositoryQuery": ["none"],-                    "repos": ["gorilla/mux"],

Can you explain why we need to remove this? ( I don’t have much context )

uwedeportivo

comment created time in 5 hours

issue commentsourcegraph/sourcegraph

Searches from browser extension should respect 'search.defaultPatternType' setting

cc @sourcegraph/web for triaging, or maybe it's a backend bug?

byrongrogan

comment created time in 7 hours

Pull request review commentsourcegraph/sourcegraph

search: add validation and alert functions

 func TestQuery_StringValues(t *testing.T) { 	}) } +func TestQuery_Validate(t *testing.T) {+	cases := []struct {+		Name       string+		Query      string+		SearchType SearchType+		Want       string+	}{+		{+			Name:       `Structural search validates`,+			Query:      `patterntype:structural ":[_]"`,+			SearchType: SearchTypeStructural,+			Want:       `the parameter "case:" is not valid for structural search`,+		},+		{+			Name:       `Structural search incompatible with "case:"`,+			Query:      `patterntype:structural case:yes ":[_]"`,+			SearchType: SearchTypeStructural,+			Want:       `the parameter "case:" is not valid for structural search, matching is always case-sensitive`,+		},+	}+	for _, tt := range cases {+		t.Run(tt.Name, func(t *testing.T) {+			q, _ := ParseAndCheck(tt.Query)+			if got := Validate(q, tt.SearchType); got != nil {+				if diff := cmp.Diff(got.Error(), tt.Want); diff != "" {+					t.Fatal(diff)

TIL! But I still feel little benefit using t.Error.

rvantonder

comment created time in 7 hours

issue commentgogs/gogs

Race condition can make MaxCreationLimit useless

Thank you for a high quality report!

shouc

comment created time in 8 hours

PR merged gogs/gogs

log: migrate to unknwon.dev/clog/v2
+582 -505

0 comment

71 changed files

unknwon

pr closed time in 8 hours

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 1c09373b4f7dbc68154c817b4ee44bfa3b3f637c

log: migrate to unknwon.dev/clog/v2 (#5927) * Add unknwon.dev/clog/v2 * Update all places

view details

push time in 8 hours

delete branch gogs/gogs

delete branch : jc/migrate-clog-v2

delete time in 8 hours

PR opened gogs/gogs

log: migrate to unknwon.dev/clog/v2
+582 -505

0 comment

71 changed files

pr created time in 8 hours

create barnchgogs/gogs

branch : jc/migrate-clog-v2

created branch time in 8 hours

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 422a20648466f270de195dce3bca04e977bacd13

conf: remove unused config option SHOW_FOOTER_VERSION

view details

push time in 10 hours

Pull request review commentsourcegraph/sourcegraph

search: add validation and alert functions

 func TestQuery_StringValues(t *testing.T) { 	}) } +func TestQuery_Validate(t *testing.T) {+	cases := []struct {+		Name       string+		Query      string+		SearchType SearchType+		Want       string+	}{+		{+			Name:       `Structural search validates`,+			Query:      `patterntype:structural ":[_]"`,+			SearchType: SearchTypeStructural,+			Want:       `the parameter "case:" is not valid for structural search`,+		},+		{+			Name:       `Structural search incompatible with "case:"`,+			Query:      `patterntype:structural case:yes ":[_]"`,+			SearchType: SearchTypeStructural,+			Want:       `the parameter "case:" is not valid for structural search, matching is always case-sensitive`,+		},+	}+	for _, tt := range cases {+		t.Run(tt.Name, func(t *testing.T) {+			q, _ := ParseAndCheck(tt.Query)+			if got := Validate(q, tt.SearchType); got != nil {+				if diff := cmp.Diff(got.Error(), tt.Want); diff != "" {+					t.Fatal(diff)

I often find Fatal is more convenient when a test actually fails. It stops further process as the whole testing is going fail anyway, thus less nosies for me.

rvantonder

comment created time in 10 hours

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha e545c310eefde55f3e7c55a185c1348b13180074

CHANGELOG: add missing entry for ce1ec81d6f [CI SKIP]

view details

push time in 10 hours

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 33c6341ccd765fa631d6863aeeca12a6a5e04658

osutil: add unit tests

view details

ᴜɴᴋɴᴡᴏɴ

commit sha ce1ec81d6fa4b9531eee8c51a6ce1a095ea9beb2

repo/editor: clean up tree path Fixes a security issue reported by @zeripath.

view details

push time in 10 hours

Pull request review commentsourcegraph/src-cli

Use goreleaser to build releases and also publish Homebrew formula

+dist: release+env:+  - GO111MODULE=on+before:+  hooks:+    - go mod download+    - go mod tidy+builds:+-+  main: ./cmd/src/+  binary: src+  ldflags:+    - -X main.build={{.Version}}+  goos:+    - linux+    - windows+    - darwin+  goarch:+    - amd64+  env:+  - CGO_ENABLED=0

nit:

    - CGO_ENABLED=0
mrnugget

comment created time in 11 hours

startedgoreleaser/goreleaser

started time in 11 hours

issue commentgogs/gogs

docker run gogs with raspberry 4b

Hi, have you tried this Docker image? https://hub.docker.com/repository/docker/gogs/gogs-rpi

dongshimou

comment created time in 13 hours

Pull request review commentsourcegraph/src-cli

Take Docker image content digest into cache key

 Format of the action JSON files: 	}) } +func validateAction(ctx context.Context, action Action) error {+	for _, step := range action.Steps {+		if step.Type == "docker" {+			if step.Dockerfile == "" && step.Image == "" {+				return fmt.Errorf("docker run step has to specify either 'image' or 'dockerfile'")+			}++			if step.Dockerfile != "" && step.Image != "" {+				return fmt.Errorf("docker run step may specify either image (%q) or dockerfile, not both", step.Image)+			}++			if step.ImageContentDigest != "" {+				return errors.New("Setting the ImageContentDigest field of a docker run step is not allowed")

nit:

				return errors.New("setting the ImageContentDigest field of a docker run step is not allowed")
mrnugget

comment created time in 13 hours

push eventsourcegraph/sourcegraph

Joe Chen

commit sha af208e262541dd17aa9e2d853a4bf22e047546ab

Fix lint

view details

push time in 13 hours

push eventsourcegraph/sourcegraph

Joe Chen

commit sha c1e1064a2d7ec2ece89e896686a715cf683b2154

repos: fix tests

view details

push time in 13 hours

PR opened sourcegraph/sourcegraph

repo: normalize `private` column from the `metadata`

<!-- Reminder: Have you updated the changelog and relevant docs (user docs, architecture diagram, etc) ? -->

+107 -1

0 comment

14 changed files

pr created time in 13 hours

create barnchsourcegraph/sourcegraph

branch : jc/repo-normalize-visibility-column

created branch time in 13 hours

starteddandavison/delta

started time in 14 hours

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha b74ecd8a75fc030e818f426ef722a54ca63f45c6

CHANGELOG: add missing entry for ea75f01ba2 [CI SKIP]

view details

push time in 16 hours

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha bcc1ec65f9a2d07909a0cdb74f4e3bf32517794e

.travis: fix config warning [CI SKIP]

view details

push time in 16 hours

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 7b5b0709008e51de168947d9058a3e88a5fd3abc

docs: add steps to install npm and lessc [CI SKIP]

view details

ᴜɴᴋɴᴡᴏɴ

commit sha 3a2b2de8141b5843892e64f9c165c1d7afb3724a

Makefile: generate Sourcemap for less files [CI SKIP]

view details

ᴜɴᴋɴᴡᴏɴ

commit sha ea75f01ba2e8ba97d3ca101db3a844c76c49d737

admin: show all version in dashboard And removed version info from footer.

view details

ᴜɴᴋɴᴡᴏɴ

commit sha e82c96dab156a54e0d28d502c776bcea69b0b735

log: use trace level for some logs

view details

push time in 16 hours

issue closedgogs/gogs

Plans for using Go 1.11 modules feature

Lots of awesome Go projects started using Go 1.11 modules feature. Are there any plans using this in Gogs? from keeping vendor directory to using go.mod and go.sum?

closed time in 18 hours

hamidfzm

issue commentgogs/gogs

Plans for using Go 1.11 modules feature

I think this is implemented already!

hamidfzm

comment created time in 18 hours

issue openedsourcegraph/sourcegraph

RFC 113: Move GitLab permissions syncing to background in repo-updater

This is a placeholder issue to reverse estimated time in 3.14 planning for implementing the RFC 113. More specific issues will be created along the way.

created time in 19 hours

issue commentsourcegraph/sourcegraph

The browser extension injects a CSS file to the webpage

cc @sourcegraph/web for triaging.

eight04

comment created time in a day

Pull request review commentsourcegraph/sourcegraph

search: add validation and alert functions

 func addQueryRegexpField(query *query.Query, field, pattern string) syntax.Parse 	} 	return expr }++// newAlert creates a simple alert with a title and description that can be+// directly returned by functions that implement the GraphQL search+// interface.+func newAlert(title string, description string) SearchImplementer {

nit: It's in the huge namespace of "graphqlbackend", better to be more explicit.

func newSearchAlert(title string, description string) SearchImplementer {
rvantonder

comment created time in a day

Pull request review commentsourcegraph/sourcegraph

search: add validation and alert functions

 func parseAndCheck(conf *types.Config, input string) (*Query, error) { 	return &Query{conf: conf, Query: checkedQuery}, nil } +// Validate validates legal combinations of fields and search patterns of a+// successfully parsed query.+func Validate(q *Query, searchType SearchType) error {+	if searchType == SearchTypeStructural {+		if q.Fields[FieldCase] != nil {+			return errors.New(`the parameter "case:" is not valid for structural search, matching is always case-sensitive`)

Just thinking, instead of saying it's "invalid", should we say it has "no effect on xx search"?

rvantonder

comment created time in a day

push eventsourcegraph/sourcegraph

ᴜɴᴋɴᴡᴏɴ

commit sha a57358d8f347807fadbd8c7daa3cd7441533b9d4

migrations: drop event_logs_check_url_not_empty constraint (#8483) * migrations: drop event_logs_check_url_not_empty constraint * Fix tests

view details

push time in a day

delete branch sourcegraph/sourcegraph

delete branch : jc/db-event-logs-remove-url-constraint

delete time in a day

PR merged sourcegraph/sourcegraph

migrations: drop event_logs_check_url_not_empty constraint

Due to the fact that we have backend telemetry that does not have any URL associated.

Context: https://sourcegraph.slack.com/archives/CN4FC7XT4/p1582043517158100?thread_ts=1582012100.156700&cid=CN4FC7XT4

+56 -6

0 comment

5 changed files

unknwon

pr closed time in a day

push eventsourcegraph/sourcegraph

Joe Chen

commit sha 9bde19f32b3bcf8896a731130b3c9585db961d99

Fix tests

view details

push time in a day

PR opened sourcegraph/sourcegraph

migrations: drop event_logs_check_url_not_empty constraint

Due to the fact that we have backend telemetry that does not have any URL associated.

Context: https://sourcegraph.slack.com/archives/CN4FC7XT4/p1582043517158100?thread_ts=1582012100.156700&cid=CN4FC7XT4

+56 -1

0 comment

4 changed files

pr created time in a day

issue closedgogs/gogs

debug memory leakage

https://try.gogs.io/debug https://try.gogs.io/debug/profile/

aa

bb

closed time in a day

linsfg

issue commentgogs/gogs

debug memory leakage

Thank you for the feedback! However, I'm closing this thread according to the issue template.

linsfg

comment created time in a day

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 8d736086723bebb4a7796a3a71d296cf4b6932ad

docs: improve set up guide [CI SKIP]

view details

push time in a day

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 9f7433d4f35013492bb5066800092b73faccb44e

docs: add local development [CI SKIP]

view details

push time in a day

push eventgogs/gogsweb.peach

imgbot[bot]

commit sha a2cdd877c21c1c95ff61e80eb21c244202ae8b88

[ImgBot] Optimize images (#8) /public/img/brands/pmooe.png -- 4.34kb -> 4.19kb (3.4%) Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com> Co-authored-by: Imgbot <help@imgbot.net>

view details

push time in 2 days

PR merged gogs/gogsweb.peach

[ImgBot] Optimize images

Beep boop. Your images are optimized!

Your image file size has been reduced!

<details> <summary> Details </summary>

File Before After Percent reduction
/public/img/brands/pmooe.png 4.34kb 4.19kb 3.40%

</details>


📝docs | :octocat: repo | 🙋issues | 🏅swag | 🏪marketplace

+0 -0

0 comment

1 changed file

imgbot[bot]

pr closed time in 2 days

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha bbffd1b5b69a7c83d7aee740ebb3785ea9033002

docker: fix Docker Hub build failure

view details

push time in 2 days

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 31d17de26c3a0842adb353bd6134fe6ad6161aa6

README: clean up

view details

push time in 2 days

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 3797a4839d0d884e34d515ae12c9b0c5c52a12a5

README: update Features list [CI SKIP]

view details

push time in 2 days

push eventgogs/gogsweb.peach

ᴜɴᴋɴᴡᴏɴ

commit sha 036dac9cb304a6ead78d66ce2c20cc24d4c7be00

Add new user

view details

ᴜɴᴋɴᴡᴏɴ

commit sha 703b18c2f57a519d437f4c53f175d2693c6e53fc

Merge branch 'master' of github.com:gogs/gogsweb.peach

view details

push time in 2 days

push eventgogs/docs

ᴜɴᴋɴᴡᴏɴ

commit sha a0849b93c74f1e79883882d9834fa98785c059d1

Custom template

view details

push time in 2 days

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha f85b17a00e0a484a870511726118a36375c3d97a

mailer: fix template not found error

view details

push time in 2 days

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 33b6478cc7f1344636c04103a87f7d1a1dc3ed95

go.mod: update github.com/go-macaron/i18n to v0.5.0 Fixes a security issue reported by Dor Tumarkin, Security Researcher at Checkmarx.

view details

push time in 2 days

created taggo-macaron/i18n

tagv0.5.0

Package i18n provides an Internationalization and Localization middleware for Macaron applications

created time in 2 days

delete branch sourcegraph/about

delete branch : jc/kebectl-debug-server

delete time in 2 days

push eventsourcegraph/about

ᴜɴᴋɴᴡᴏɴ

commit sha 471befc0f8e3feb4e4bc3afcfdf759e9a38876c5

Add `kubectl` command to access debug server to cheatsheet (#589)

view details

push time in 2 days

PR merged sourcegraph/about

Reviewers
Add `kubectl` command to access debug server to cheatsheet

https://sourcegraph.slack.com/archives/CHPC7UX16/p1582011627226200?thread_ts=1581988532.217800&cid=CHPC7UX16

image

+7 -0

0 comment

1 changed file

unknwon

pr closed time in 2 days

issue commentgogs/gogs

Support OAuth 2 login/signup

https://github.com/golang/oauth2

nhalstead

comment created time in 2 days

PR opened sourcegraph/about

Reviewers
Add `kubectl` command to access debug server to cheatsheet

https://sourcegraph.slack.com/archives/CHPC7UX16/p1582011627226200?thread_ts=1581988532.217800&cid=CHPC7UX16

image

+7 -0

0 comment

1 changed file

pr created time in 2 days

create barnchsourcegraph/about

branch : jc/kebectl-debug-server

created branch time in 2 days

push eventgogs/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 317bca10089fff3a1684bd5583c5d5ff2e977b2f

Add CHANGELOG and adopt new release workflow In development, the version now has +dev suffix indicates it is not a binary release.

view details

push time in 2 days

push eventgogs/docs

ᴜɴᴋɴᴡᴏɴ

commit sha 59cda4929bb35af4e851b648be95e0688392b8fd

Remove changelog

view details

push time in 2 days

pull request commentsourcegraph/sourcegraph

CODEOWNERS: remove chrismwendt

😭

chrismwendt

comment created time in 2 days

pull request commentsourcegraph/sourcegraph

gitserver: Redact token when unable to clone repo

We didn't have READ FOR UPDATE in this thread? :trollface:

ryanslade

comment created time in 2 days

Pull request review commentsourcegraph/sourcegraph

gitserver: mark potential corrupt repos based on stderr

 import (  	"github.com/hashicorp/go-multierror" 	"github.com/pkg/errors"+	"github.com/sourcegraph/sourcegraph/internal/api"+	"github.com/sourcegraph/sourcegraph/internal/lazyregexp"  	"github.com/prometheus/client_golang/prometheus" 

LOL

keegancsmith

comment created time in 2 days

issue commentsourcegraph/sourcegraph

Server keeps cloning repositories and cleaning them up

As a workaround, you could see env var SRC_REPOS_DESIRED_PERCENT_FREE to lower number, e.g. 1 or 0, default is 10.

saveman71

comment created time in 2 days

Pull request review commentsourcegraph/sourcegraph

bitbucketserver: clean up plugin configuration

         }       }     },+    "plugin": {+      "title": "BitbucketServerPlugin",+      "description": "Configuration for Bitbucket Server Sourcegraph plugin",+      "type": "object",+      "properties": {+        "webhooks": {+          "title": "BitbucketServerPluginWebhooks",+          "type": "object",+          "required": ["secret"],+          "properties": {+            "secret": {+              "description": "Secret for authenticating incoming webhook payloads",+              "type": "string",+              "minLength": 1+            }+          }+        },+        "fastPerm": {+          "description": "Enables fetching Bitbucket Server permissions through the roaring bitmap endpoint. Warning: there may be performance degradation under significant load.",+          "type": "string",+          "enum": ["enabled", "disabled"],

Unfortunately, we seem having both styles: https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/sourcegraph/sourcegraph%24+file:%5Eschema/+%22enabled%22&patternType=literal

kzh

comment created time in 2 days

Pull request review commentsourcegraph/sourcegraph

gitserver: mark potential corrupt repos based on stderr

 import (  	"github.com/hashicorp/go-multierror" 	"github.com/pkg/errors"+	"github.com/sourcegraph/sourcegraph/internal/api"+	"github.com/sourcegraph/sourcegraph/internal/lazyregexp"  	"github.com/prometheus/client_golang/prometheus" 

We have "corrupted" import grouping here :trollface:

keegancsmith

comment created time in 2 days

Pull request review commentsourcegraph/sourcegraph

continue to display redis-based usage statistics for continuity

 import ( 	"context" 	"time" -	"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/usagestats"+	usagestatsdeprecated "github.com/sourcegraph/sourcegraph/cmd/frontend/internal/pkg/usagestatsdeprecated"

nit: redundant import renaming

	"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/pkg/usagestatsdeprecated"
dadlerj

comment created time in 2 days

Pull request review commentsourcegraph/sourcegraph

a8n: Support GitHub CheckRuns

 type CheckSuite struct { 	// On of ACTION_REQUIRED, CANCELLED, FAILURE, NEUTRAL, SUCCESS, TIMED_OUT 	Conclusion string 	ReceivedAt time.Time+	CheckRuns  struct{ Nodes []CheckRun } }  func (c *CheckSuite) Key() string { 	key := fmt.Sprintf("%s:%s:%s:%d", c.ID, c.Status, c.Conclusion, c.ReceivedAt.UnixNano()) 	return strconv.FormatUint(fnv1.HashString64(key), 16) } +// CheckRun represents the status of a checkrun+type CheckRun struct {+	ID string+	// One of COMPLETED, IN_PROGRESS, QUEUED, REQUESTED+	Status string+	// On of ACTION_REQUIRED, CANCELLED, FAILURE, NEUTRAL, SUCCESS, TIMED_OUT+	Conclusion string

Could you add a docstring?

ryanslade

comment created time in 2 days

Pull request review commentsourcegraph/sourcegraph

a8n: Support GitHub CheckRuns

 type CheckSuite struct { 	// On of ACTION_REQUIRED, CANCELLED, FAILURE, NEUTRAL, SUCCESS, TIMED_OUT 	Conclusion string 	ReceivedAt time.Time+	CheckRuns  struct{ Nodes []CheckRun } }  func (c *CheckSuite) Key() string { 	key := fmt.Sprintf("%s:%s:%s:%d", c.ID, c.Status, c.Conclusion, c.ReceivedAt.UnixNano()) 	return strconv.FormatUint(fnv1.HashString64(key), 16) } +// CheckRun represents the status of a checkrun+type CheckRun struct {+	ID string+	// One of COMPLETED, IN_PROGRESS, QUEUED, REQUESTED+	Status string+	// On of ACTION_REQUIRED, CANCELLED, FAILURE, NEUTRAL, SUCCESS, TIMED_OUT

Thank god I found a typo, otherwise I feel so useless!

ryanslade

comment created time in 2 days

Pull request review commentsourcegraph/sourcegraph

a8n: Support GitHub CheckRuns

 type CheckSuite struct { 	// On of ACTION_REQUIRED, CANCELLED, FAILURE, NEUTRAL, SUCCESS, TIMED_OUT 	Conclusion string 	ReceivedAt time.Time+	CheckRuns  struct{ Nodes []CheckRun } }  func (c *CheckSuite) Key() string { 	key := fmt.Sprintf("%s:%s:%s:%d", c.ID, c.Status, c.Conclusion, c.ReceivedAt.UnixNano()) 	return strconv.FormatUint(fnv1.HashString64(key), 16) } +// CheckRun represents the status of a checkrun+type CheckRun struct {+	ID string+	// One of COMPLETED, IN_PROGRESS, QUEUED, REQUESTED+	Status string+	// On of ACTION_REQUIRED, CANCELLED, FAILURE, NEUTRAL, SUCCESS, TIMED_OUT

typo:

	// One of ACTION_REQUIRED, CANCELLED, FAILURE, NEUTRAL, SUCCESS, TIMED_OUT
ryanslade

comment created time in 2 days

push eventgogs/docs

ᴜɴᴋɴᴡᴏɴ

commit sha f20e8d8a3355cbdbaa3b2dee1b904f76725ebd5e

Fix emoji

view details

push time in 2 days

push eventgogs/docs

ᴜɴᴋɴᴡᴏɴ

commit sha b72c79be67ba55544b45dce40c4abe90abe3cc41

Custom template

view details

push time in 2 days

push eventgogs/docs

ᴜɴᴋɴᴡᴏɴ

commit sha ce50887f8de30df20b9fb62f3935f18894ccbb4f

Changelog

view details

push time in 2 days

push eventgogs/gogs

Michael Li

commit sha 4d83fd4238e177d9327c760a5386bc53f25dedbb

Use go-bindata to embed `public` and `templates` files into binary (#5920) * fixed private repositories are hidden in the organization's view * use go-bindata integrate public and templates files to gogs binary * optimize Dockerfile don't COPY public and templates files * use kevinburke's go-bindata to generate assets code * reset develepment as default run mode in configure file * optimize generated assets code relayout and help function * fixed code format * Update conf/app.ini * assets: add LICENSE headers * Some housekeeping * assets/public: simplify code logic * assets/templates: simplify code logic * cmd/web: more concise variable names * Minor changes * Add custom public and templates support back Co-authored-by: ᴜɴᴋɴᴡᴏɴ <u@gogs.io>

view details

push time in 2 days

PR merged gogs/gogs

Use go-bindata to embed `public` and `templates` files into binary status/reviewed status/waits for merge
  1. use go-bindata pack up public and templates files into gogs binary then no need public/templates file in gogs work directory.
  2. after this patch will make gogs update more convenience.
  3. after make relealse the package will just contain files below:
% tree -L  1 gogs
gogs
├── LICENSE
├── README.md
├── README_ZH.md
├── gogs
└── scripts

+41352 -5870

8 comments

30 changed files

alimy

pr closed time in 2 days

pull request commentgogs/gogs

Use go-bindata to embed `public` and `templates` files into binary

OK, I think I'm happy with the current state, merging!

alimy

comment created time in 2 days

push eventalimy/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha b8d5ef09dd0600770acf73ee770643af20b0a836

Minor changes

view details

ᴜɴᴋɴᴡᴏɴ

commit sha ebf945b6e1b5d87df8bc08f3094df21df7b22d3c

Add custom public and templates support back

view details

push time in 2 days

push eventalimy/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha b24331646afcb82328f25b4b05bacb76a13c3c59

cmd/web: more concise variable names

view details

push time in 3 days

push eventalimy/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 0a2ab12d504bf0e03628f9a2c0e615721756773a

assets/templates: simplify code logic

view details

push time in 3 days

push eventalimy/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 1558587e30217a6584fc48ce636ee9335958a1e6

assets/public: simplify code logic

view details

push time in 3 days

delete branch gogs/gogs

delete branch : pullrequests/alimy/pr-bindata

delete time in 3 days

push eventalimy/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 30bb9051e304e46875ebf2af94914875c870c06c

assets: add LICENSE headers

view details

ᴜɴᴋɴᴡᴏɴ

commit sha e7f4e70a4f1fdb64401e7aff1e178bb6a437c7e3

Some housekeeping

view details

push time in 3 days

create barnchgogs/gogs

branch : pullrequests/alimy/pr-bindata

created branch time in 3 days

Pull request review commentsourcegraph/sourcegraph

gitserver: custom fetch command by domain/path

 RUN apk update && apk add --no-cache \     # from our *Minimum Supported Version* which alone dictates     # the features we can depend on. See this link for more information:     # https://github.com/sourcegraph/sourcegraph/blob/master/doc/dev/postgresql.md#version-requirements-    'bash=5.0.0-r0' 'postgresql-contrib=11.6-r0' 'postgresql=11.6-r0' \

It's a fix to our consistent failing in e2e pipeline. Technically not related to this PR.

uwedeportivo

comment created time in 3 days

push eventalimy/gogs

ᴜɴᴋɴᴡᴏɴ

commit sha 4d89b1b492e6bab650f238c27cbe1cdb80d079ee

Update conf/app.ini

view details

push time in 3 days

Pull request review commentgogs/gogs

Use go-bindata to embed `public` and `templates` files into binary

 APP_NAME = Gogs RUN_USER = git ; Either "dev", "prod" or "test" RUN_MODE = dev+; Either load public and templates assets from disk
; Enable to load assets (i.e. "conf", "templates", "public") from disk instead of embedded bindata
alimy

comment created time in 3 days

issue commentsourcegraph/sourcegraph

Core Services: 3.13 Tracking Issue

W05 Summary

W06 Plan [2020-02-17]

tsenart

comment created time in 3 days

Pull request review commentsourcegraph/lsif-go

Move protocol writer into public package

+package protocol++import (+	"encoding/json"+	"fmt"+	"io"+	"io/ioutil"+	"strconv"+)++type Writer struct {

Would be great to have docstring for this struct.

efritz

comment created time in 3 days

push eventgo-macaron/i18n

ᴜɴᴋɴᴡᴏɴ

commit sha d63b93da5902d9af0488c78dfad18f4ecca7ca3a

ci: upload coverage to Codecov

view details

push time in 3 days

push eventgo-macaron/i18n

ᴜɴᴋɴᴡᴏɴ

commit sha f6dc61a9e896131cf4629995dbebc6fc7bc8bb5d

Create lsif.yml

view details

push time in 3 days

push eventgo-macaron/i18n

ᴜɴᴋɴᴡᴏɴ

commit sha 60abc7269e485af6c345dda769a46039d3ce365e

ci: remove Go 1.6

view details

push time in 3 days

push eventgo-macaron/i18n

ᴜɴᴋɴᴡᴏɴ

commit sha 0c9693199f3e00ec17b4f09149bb3e534c610e1c

README: update badges and links

view details

ᴜɴᴋɴᴡᴏɴ

commit sha 326bc77d7eb1d9a2362a904ef97ab922c9c68082

ci: update to latest template

view details

ᴜɴᴋɴᴡᴏɴ

commit sha 329b0c4844cc16a5a253c011b55180598e707735

security: fix Open Redirection vulnerability

view details

push time in 3 days

pull request commentgogs/gogs

Use go-bindata to embed `public` and `templates` files into binary

Thanks again for the contribution!

PS: If you think you don't have bandwidth work on this in the coming week, LMK! I'll push changes to this PR. I want to get this merged :)

alimy

comment created time in 4 days

Pull request review commentgogs/gogs

Use go-bindata to embed `public` and `templates` files into binary

 import ( 	"github.com/nfnt/resize" 	"github.com/unknwon/cae/zip" 	"github.com/unknwon/com"+
alimy

comment created time in 4 days

Pull request review commentgogs/gogs

Use go-bindata to embed `public` and `templates` files into binary

 import ( 	"fmt" 	"html/template" +	"gogs.io/gogs/internal/assets/templates"

It is misplaced, should be moved to line 16.

alimy

comment created time in 4 days

Pull request review commentgogs/gogs

Use go-bindata to embed `public` and `templates` files into binary

+package public

This file seems having more complicated logic than I would expect, do you think there is a way to reuse some stdlib functions/methods to simplify it? Or did you copy it from go-bindata/go-bindata?

alimy

comment created time in 4 days

Pull request review commentgogs/gogs

Use go-bindata to embed `public` and `templates` files into binary

 and it takes care of all the other things for you`,  // checkVersion checks if binary matches the version of templates files. func checkVersion() {

Since we're now embedding all these files, I think it's time to get rid of this function entirely!

alimy

comment created time in 4 days

Pull request review commentgogs/gogs

Use go-bindata to embed `public` and `templates` files into binary

 APP_NAME = Gogs RUN_USER = git ; Either "dev", "prod" or "test" RUN_MODE = dev+; Either enable use embedded public and templates assets+ENABLE_ASSETS = true
LOAD_ASSETS_FROM_DISK = false

I think we should have default which read assets from embedded bindata, but optionally (i.e. in dev env) load it from disk.

alimy

comment created time in 4 days

Pull request review commentgogs/gogs

Use go-bindata to embed `public` and `templates` files into binary

+package public++import (+	"bytes"+	"net/http"+	"os"+	"path/filepath"+	"strings"+	"time"+)++//go:generate go-bindata -nomemcopy -pkg=public -ignore="\\.DS_Store|less" -prefix=../../../public -debug=false -o=public_gen.go ../../../public/...++type assetFile struct {+	*bytes.Reader+	name            string+	childInfos      []os.FileInfo+	childInfoOffset int+}++type assetOperator struct{}++// Open implement http.FileSystem interface+func (f *assetOperator) Open(name string) (http.File, error) {+	var err error+	if len(name) > 0 && name[0] == '/' {+		name = name[1:]+	}+	content, err := Asset(name)+	if err == nil {+		return &assetFile{name: name, Reader: bytes.NewReader(content)}, nil+	}+	children, err := AssetDir(name)+	if err == nil {+		childInfos := make([]os.FileInfo, 0, len(children))+		for _, child := range children {+			childPath := filepath.Join(name, child)+			info, errInfo := AssetInfo(filepath.Join(name, child))+			if errInfo == nil {+				childInfos = append(childInfos, info)+			} else {+				childInfos = append(childInfos, newDirFileInfo(childPath))+			}+		}+		return &assetFile{name: name, childInfos: childInfos}, nil+	} else {+		// If the error is not found, return an error that will+		// result in a 404 error. Otherwise the server returns+		// a 500 error for files not found.+		if strings.Contains(err.Error(), "not found") {+			return nil, os.ErrNotExist+		}+		return nil, err+	}+}++// Close no need do anything+func (f *assetFile) Close() error {+	return nil+}++// Readdir read dir's children file info+func (f *assetFile) Readdir(count int) ([]os.FileInfo, error) {+	if len(f.childInfos) == 0 {+		return nil, os.ErrNotExist+	}+	if count <= 0 {+		return f.childInfos, nil+	}+	if f.childInfoOffset+count > len(f.childInfos) {+		count = len(f.childInfos) - f.childInfoOffset+	}+	offset := f.childInfoOffset+	f.childInfoOffset += count+	return f.childInfos[offset : offset+count], nil+}++// Stat read file info from asset item+func (f *assetFile) Stat() (os.FileInfo, error) {+	if len(f.childInfos) != 0 {+		return newDirFileInfo(f.name), nil+	}+	return AssetInfo(f.name)+}++type dirFileInfo struct {+	*bindataFileInfo+}++// IsDir return file whether a directory+func (fi *dirFileInfo) IsDir() bool {+	return fi.mode&os.ModeDir != 0+}++// newDirFileInfo return default dir file info+func newDirFileInfo(name string) os.FileInfo {+	return &dirFileInfo{+		&bindataFileInfo{+			name:    name,+			size:    0,+			mode:    os.FileMode(2147484068), // equal os.FileMode(0644)|os.ModeDir+			modTime: time.Time{},+		}}+}++// AssetFile return a http.FileSystem instance that data backend by asset+func AssetFile() http.FileSystem {

I think this is more clear:

func FileSystem() http.FileSystem {
alimy

comment created time in 4 days

Pull request review commentgogs/gogs

Use go-bindata to embed `public` and `templates` files into binary

 LDFLAGS += -X "gogs.io/gogs/internal/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')" LDFLAGS += -X "gogs.io/gogs/internal/setting.BuildGitHash=$(shell git rev-parse HEAD)" -DATA_FILES := $(shell find conf | sed 's/ /\\ /g')+ASSETS_FILES := $(shell find conf | sed 's/ /\\ /g')

I think calling conf files as "assets" is not accurate, because "asset" includes all "conf", "templates" and "public". So either keep it as DATA_FILES or rename it to CONF_FILES.

alimy

comment created time in 4 days

Pull request review commentgogs/gogs

Use go-bindata to embed `public` and `templates` files into binary

 LDFLAGS += -X "gogs.io/gogs/internal/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')" LDFLAGS += -X "gogs.io/gogs/internal/setting.BuildGitHash=$(shell git rev-parse HEAD)" -DATA_FILES := $(shell find conf | sed 's/ /\\ /g')+ASSETS_FILES := $(shell find conf | sed 's/ /\\ /g')+TEMPLATES_FILES := $(shell find templates | sed 's/ /\\ /g')+PUBLIC_FILES := $(shell find public | sed 's/ /\\ /g') LESS_FILES := $(wildcard public/less/gogs.less public/less/_*.less)-GENERATED  := internal/bindata/bindata.go public/css/gogs.css+GENERATED  := internal/assets/assets_gen.go internal/assets/templates/templates_gen.go internal/assets/public/public_gen.go public/css/gogs.css

We should put CONF_FILES in its own directory as well.

alimy

comment created time in 4 days

more