gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/grpc/internal/binarylog/binarylog_testutil.go (about) 1 /* 2 * 3 * Copyright 2018 gRPC authors. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 */ 18 19 // This file contains exported variables/functions that are exported for testing 20 // only. 21 // 22 // An ideal way for this would be to put those in a *_test.go but in binarylog 23 // package. But this doesn't work with staticcheck with go module. Error was: 24 // "MdToMetadataProto not declared by package binarylog". This could be caused 25 // by the way staticcheck looks for files for a certain package, which doesn't 26 // support *_test.go files. 27 // 28 // Move those to binary_test.go when staticcheck is fixed. 29 30 package binarylog 31 32 //goland:noinspection GoUnusedGlobalVariable 33 var ( 34 // AllLogger is a logger that logs all headers/messages for all RPCs. It's 35 // for testing only. 36 AllLogger = NewLoggerFromConfigString("*") 37 // MdToMetadataProto converts metadata to a binary logging proto message. 38 // It's for testing only. 39 MdToMetadataProto = mdToMetadataProto 40 // AddrToProto converts an address to a binary logging proto message. It's 41 // for testing only. 42 AddrToProto = addrToProto 43 )