From bc8702749f84370370aaf44609ec51686f42707e Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Wed, 9 Aug 2023 15:11:45 +0800 Subject: [PATCH] ci: add go-docs file and copyright scripts Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- pkg/apistruct/doc.go | 15 ++++++ pkg/authverify/doc.go | 15 ++++++ pkg/callbackstruct/doc.go | 15 ++++++ pkg/common/cmd/doc.go | 15 ++++++ pkg/common/config/doc.go | 15 ++++++ pkg/common/convert/doc.go | 15 ++++++ pkg/common/db/cache/doc.go | 15 ++++++ pkg/common/db/controller/doc.go | 15 ++++++ pkg/common/db/localcache/doc.go | 15 ++++++ pkg/common/db/relation/doc.go | 15 ++++++ pkg/common/db/s3/cont/doc.go | 15 ++++++ pkg/common/db/s3/cos/doc.go | 15 ++++++ pkg/common/db/s3/doc.go | 15 ++++++ pkg/common/db/s3/minio/doc.go | 15 ++++++ pkg/common/db/s3/oss/doc.go | 15 ++++++ pkg/common/db/table/relation/doc.go | 15 ++++++ pkg/common/db/table/unrelation/doc.go | 15 ++++++ pkg/common/db/unrelation/doc.go | 15 ++++++ pkg/common/http/doc.go | 15 ++++++ pkg/common/kafka/doc.go | 15 ++++++ pkg/common/locker/doc.go | 15 ++++++ pkg/common/prome/doc.go | 15 ++++++ pkg/common/startrpc/doc.go | 15 ++++++ pkg/msgprocessor/doc.go | 15 ++++++ pkg/rpcclient/doc.go | 15 ++++++ pkg/rpcclient/notification/doc.go | 15 ++++++ pkg/statistics/doc.go | 15 ++++++ scripts/gen-swagger-docs.sh | 71 +++++++++++++++++++++++++++ scripts/gendoc.sh | 37 ++++++++++++++ scripts/lib/test.sh | 1 - tools/changelog/doc.go | 15 ++++++ tools/infra/doc.go | 15 ++++++ tools/ncpu/doc.go | 15 ++++++ tools/yamlfmt/doc.go | 15 ++++++ 34 files changed, 573 insertions(+), 1 deletion(-) create mode 100644 pkg/apistruct/doc.go create mode 100644 pkg/authverify/doc.go create mode 100644 pkg/callbackstruct/doc.go create mode 100644 pkg/common/cmd/doc.go create mode 100644 pkg/common/config/doc.go create mode 100644 pkg/common/convert/doc.go create mode 100644 pkg/common/db/cache/doc.go create mode 100644 pkg/common/db/controller/doc.go create mode 100644 pkg/common/db/localcache/doc.go create mode 100644 pkg/common/db/relation/doc.go create mode 100644 pkg/common/db/s3/cont/doc.go create mode 100644 pkg/common/db/s3/cos/doc.go create mode 100644 pkg/common/db/s3/doc.go create mode 100644 pkg/common/db/s3/minio/doc.go create mode 100644 pkg/common/db/s3/oss/doc.go create mode 100644 pkg/common/db/table/relation/doc.go create mode 100644 pkg/common/db/table/unrelation/doc.go create mode 100644 pkg/common/db/unrelation/doc.go create mode 100644 pkg/common/http/doc.go create mode 100644 pkg/common/kafka/doc.go create mode 100644 pkg/common/locker/doc.go create mode 100644 pkg/common/prome/doc.go create mode 100644 pkg/common/startrpc/doc.go create mode 100644 pkg/msgprocessor/doc.go create mode 100644 pkg/rpcclient/doc.go create mode 100644 pkg/rpcclient/notification/doc.go create mode 100644 pkg/statistics/doc.go create mode 100644 scripts/gen-swagger-docs.sh create mode 100755 scripts/gendoc.sh create mode 100644 tools/changelog/doc.go create mode 100644 tools/infra/doc.go create mode 100644 tools/ncpu/doc.go create mode 100644 tools/yamlfmt/doc.go diff --git a/pkg/apistruct/doc.go b/pkg/apistruct/doc.go new file mode 100644 index 000000000..d99eab7b6 --- /dev/null +++ b/pkg/apistruct/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package apistruct // import "github.com/OpenIMSDK/Open-IM-Server/pkg/apistruct" diff --git a/pkg/authverify/doc.go b/pkg/authverify/doc.go new file mode 100644 index 000000000..e07d69614 --- /dev/null +++ b/pkg/authverify/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package authverify // import "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify" diff --git a/pkg/callbackstruct/doc.go b/pkg/callbackstruct/doc.go new file mode 100644 index 000000000..d9d9cd8d0 --- /dev/null +++ b/pkg/callbackstruct/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package callbackstruct // import "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct" diff --git a/pkg/common/cmd/doc.go b/pkg/common/cmd/doc.go new file mode 100644 index 000000000..75da58c57 --- /dev/null +++ b/pkg/common/cmd/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cmd // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/cmd" diff --git a/pkg/common/config/doc.go b/pkg/common/config/doc.go new file mode 100644 index 000000000..a58dd1b8f --- /dev/null +++ b/pkg/common/config/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package config // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" diff --git a/pkg/common/convert/doc.go b/pkg/common/convert/doc.go new file mode 100644 index 000000000..0789adc3f --- /dev/null +++ b/pkg/common/convert/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package convert // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert" diff --git a/pkg/common/db/cache/doc.go b/pkg/common/db/cache/doc.go new file mode 100644 index 000000000..e02c5b9ba --- /dev/null +++ b/pkg/common/db/cache/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cache // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" diff --git a/pkg/common/db/controller/doc.go b/pkg/common/db/controller/doc.go new file mode 100644 index 000000000..d54b689a6 --- /dev/null +++ b/pkg/common/db/controller/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controller // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller" diff --git a/pkg/common/db/localcache/doc.go b/pkg/common/db/localcache/doc.go new file mode 100644 index 000000000..40afac0ba --- /dev/null +++ b/pkg/common/db/localcache/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package localcache // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/localcache" diff --git a/pkg/common/db/relation/doc.go b/pkg/common/db/relation/doc.go new file mode 100644 index 000000000..a3ac7243f --- /dev/null +++ b/pkg/common/db/relation/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package relation // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation" diff --git a/pkg/common/db/s3/cont/doc.go b/pkg/common/db/s3/cont/doc.go new file mode 100644 index 000000000..bdba8501b --- /dev/null +++ b/pkg/common/db/s3/cont/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cont // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3/cont" diff --git a/pkg/common/db/s3/cos/doc.go b/pkg/common/db/s3/cos/doc.go new file mode 100644 index 000000000..bf405d0fc --- /dev/null +++ b/pkg/common/db/s3/cos/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cos // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3/cos" diff --git a/pkg/common/db/s3/doc.go b/pkg/common/db/s3/doc.go new file mode 100644 index 000000000..0a3cfe521 --- /dev/null +++ b/pkg/common/db/s3/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package s3 // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" diff --git a/pkg/common/db/s3/minio/doc.go b/pkg/common/db/s3/minio/doc.go new file mode 100644 index 000000000..704e12202 --- /dev/null +++ b/pkg/common/db/s3/minio/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package minio // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3/minio" diff --git a/pkg/common/db/s3/oss/doc.go b/pkg/common/db/s3/oss/doc.go new file mode 100644 index 000000000..9520a7ed8 --- /dev/null +++ b/pkg/common/db/s3/oss/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oss // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3/oss" diff --git a/pkg/common/db/table/relation/doc.go b/pkg/common/db/table/relation/doc.go new file mode 100644 index 000000000..fe78a700d --- /dev/null +++ b/pkg/common/db/table/relation/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package relation // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" diff --git a/pkg/common/db/table/unrelation/doc.go b/pkg/common/db/table/unrelation/doc.go new file mode 100644 index 000000000..1c0eab222 --- /dev/null +++ b/pkg/common/db/table/unrelation/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package unrelation // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation" diff --git a/pkg/common/db/unrelation/doc.go b/pkg/common/db/unrelation/doc.go new file mode 100644 index 000000000..b36a2406f --- /dev/null +++ b/pkg/common/db/unrelation/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package unrelation // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation" diff --git a/pkg/common/http/doc.go b/pkg/common/http/doc.go new file mode 100644 index 000000000..33a0d5e5d --- /dev/null +++ b/pkg/common/http/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package http // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/http" diff --git a/pkg/common/kafka/doc.go b/pkg/common/kafka/doc.go new file mode 100644 index 000000000..c796db138 --- /dev/null +++ b/pkg/common/kafka/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package kafka // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/kafka" diff --git a/pkg/common/locker/doc.go b/pkg/common/locker/doc.go new file mode 100644 index 000000000..c94581aa9 --- /dev/null +++ b/pkg/common/locker/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package locker // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/locker" diff --git a/pkg/common/prome/doc.go b/pkg/common/prome/doc.go new file mode 100644 index 000000000..0b82aa7bf --- /dev/null +++ b/pkg/common/prome/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package prome // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome" diff --git a/pkg/common/startrpc/doc.go b/pkg/common/startrpc/doc.go new file mode 100644 index 000000000..571fd971a --- /dev/null +++ b/pkg/common/startrpc/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package startrpc // import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/startrpc" diff --git a/pkg/msgprocessor/doc.go b/pkg/msgprocessor/doc.go new file mode 100644 index 000000000..2f1d0cb44 --- /dev/null +++ b/pkg/msgprocessor/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package msgprocessor // import "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor" diff --git a/pkg/rpcclient/doc.go b/pkg/rpcclient/doc.go new file mode 100644 index 000000000..f32f4f322 --- /dev/null +++ b/pkg/rpcclient/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package rpcclient // import "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" diff --git a/pkg/rpcclient/notification/doc.go b/pkg/rpcclient/notification/doc.go new file mode 100644 index 000000000..eea54e59c --- /dev/null +++ b/pkg/rpcclient/notification/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package notification // import "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification" diff --git a/pkg/statistics/doc.go b/pkg/statistics/doc.go new file mode 100644 index 000000000..4dabe2058 --- /dev/null +++ b/pkg/statistics/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package statistics // import "github.com/OpenIMSDK/Open-IM-Server/pkg/statistics" diff --git a/scripts/gen-swagger-docs.sh b/scripts/gen-swagger-docs.sh new file mode 100644 index 000000000..ddae83f4d --- /dev/null +++ b/scripts/gen-swagger-docs.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# Copyright © 2023 OpenIM. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Script to generate docs from the latest swagger spec. + +set -o errexit +set -o nounset +set -o pipefail + +# The root of the build/dist directory +OPENIM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)" + +cd /build + +# gendocs takes "input.json" as the input swagger spec. +# $1 is expected to be _ +cp /swagger-source/"$1".json input.json + +./gradle-2.5/bin/gradle gendocs --info + +#insert a TOC for top level API objects +buf="== Top Level API Objects\n\n" +top_level_models=$(grep '&[A-Za-z]*{},' /register.go | sed 's/.*&//;s/{},//') + +# check if the top level models exist in the definitions.adoc. If they exist, +# their name will be . +VERSION="${1#*_}" +for m in ${top_level_models} +do + if grep -xq "=== ${VERSION}.${m}" ./definitions.adoc + then + buf+="* <<${VERSION}.${m}>>\n" + fi +done +sed -i "1i ${buf}" ./definitions.adoc + +# fix the links in .adoc, replace <> with link:definitions.html#_x_y[x.y], and lowercase the _x_y part +sed -i -e 's|<<\(.*\)\.\(.*\)>>|link:#_\L\1_\2\E[\1.\2]|g' ./definitions.adoc +sed -i -e 's|<<\(.*\)\.\(.*\)>>|link:../definitions#_\L\1_\2\E[\1.\2]|g' ./paths.adoc + +# fix the link to <> +sed -i -e 's|<>|link:#_any[any]|g' ./definitions.adoc +sed -i -e 's|<>|link:../definitions#_any[any]|g' ./paths.adoc + +# change the title of paths.adoc from "paths" to "operations" +sed -i 's|== Paths|== Operations|g' ./paths.adoc + +# $$ has special meaning in asciidoc, we need to escape it +sed -i 's|\$\$|+++$$+++|g' ./definitions.adoc + +echo -e "=== any\nRepresents an untyped JSON map - see the description of the field for more info about the structure of this object." >> ./definitions.adoc + +asciidoctor definitions.adoc +asciidoctor paths.adoc + +cp definitions.html /output/ +cp paths.html /output/operations.html + +echo "SUCCESS" \ No newline at end of file diff --git a/scripts/gendoc.sh b/scripts/gendoc.sh new file mode 100755 index 000000000..d8ed279ce --- /dev/null +++ b/scripts/gendoc.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Copyright © 2023 OpenIM. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Iterates over two directories: 'pkg' and 'internal/pkg'. +for top in pkg internal/pkg tools +do + # Finds all subdirectories (including nested ones) under the current directory in the iteration ('pkg' or 'internal/pkg'). + for d in $(find $top -type d) + do + # Checks if 'doc.go' doesn't exist in the current subdirectory. + if [ ! -f $d/doc.go ]; then + # Checks if there are any '.go' files in the current subdirectory. + if ls $d/*.go > /dev/null 2>&1; then + # Echoes the path of the 'doc.go' file to the terminal. + # This is likely for debugging or information purposes. + echo $d/doc.go + + # Writes the package declaration and import comment to the 'doc.go' file in the current subdirectory. + # 'basename $d' retrieves the name of the current directory (last part of the path). + # The import comment is constructed based on a static base URL and the directory path. + echo "package $(basename $d) // import \"github.com/OpenIMSDK/Open-IM-Server/$d\"" > $d/doc.go + fi + fi + done +done diff --git a/scripts/lib/test.sh b/scripts/lib/test.sh index dd3d52863..63a4957c6 100644 --- a/scripts/lib/test.sh +++ b/scripts/lib/test.sh @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - # A set of helpers for tests openim::test::clear_all() { diff --git a/tools/changelog/doc.go b/tools/changelog/doc.go new file mode 100644 index 000000000..7f5e13e28 --- /dev/null +++ b/tools/changelog/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package changelog // import "github.com/OpenIMSDK/Open-IM-Server/tools/changelog" diff --git a/tools/infra/doc.go b/tools/infra/doc.go new file mode 100644 index 000000000..369d4dd8b --- /dev/null +++ b/tools/infra/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package infra // import "github.com/OpenIMSDK/Open-IM-Server/tools/infra" diff --git a/tools/ncpu/doc.go b/tools/ncpu/doc.go new file mode 100644 index 000000000..5a4243b5c --- /dev/null +++ b/tools/ncpu/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ncpu // import "github.com/OpenIMSDK/Open-IM-Server/tools/ncpu" diff --git a/tools/yamlfmt/doc.go b/tools/yamlfmt/doc.go new file mode 100644 index 000000000..2a1276a53 --- /dev/null +++ b/tools/yamlfmt/doc.go @@ -0,0 +1,15 @@ +// Copyright © 2023 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package yamlfmt // import "github.com/OpenIMSDK/Open-IM-Server/tools/yamlfmt"